|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
HTTP response builder. More...
#include <src/tooling/query/http_server.h>
Public Member Functions | |
| HttpResponse ()=default | |
| HttpResponse (int code, std::string text, std::string content_type, std::string response_body) | |
| HttpResponse & | setHeader (const std::string &name, const std::string &value) |
| Set a header. | |
| std::string | serialize () const |
| Serialize response to HTTP/1.1 format. | |
Static Public Member Functions | |
| static HttpResponse | ok (const std::string &content_type, const std::string &body) |
| static HttpResponse | json (const std::string &body) |
| static HttpResponse | html (const std::string &body) |
| static HttpResponse | text (const std::string &body) |
| static HttpResponse | notFound (const std::string &message="Not Found") |
| static HttpResponse | badRequest (const std::string &message="Bad Request") |
| static HttpResponse | serverError (const std::string &message="Internal Server Error") |
| static HttpResponse | noContent () |
Data Fields | |
| int | status_code = 200 |
| std::string | status_text = "OK" |
| std::unordered_map< std::string, std::string > | headers |
| std::string | body |
HTTP response builder.
Definition at line 94 of file http_server.h.
|
default |
Referenced by badRequest(), noContent(), notFound(), ok(), and serverError().
|
inline |
Definition at line 101 of file http_server.h.
References headers.
|
inlinestatic |
Definition at line 127 of file http_server.h.
References ascii_query::json::escape(), and HttpResponse().
|
inlinestatic |
Definition at line 115 of file http_server.h.
|
inlinestatic |
|
inlinestatic |
Definition at line 136 of file http_server.h.
References HttpResponse().
|
inlinestatic |
Definition at line 123 of file http_server.h.
References ascii_query::json::escape(), and HttpResponse().
Referenced by ascii_query::HttpServer::HttpServer().
|
inlinestatic |
Definition at line 107 of file http_server.h.
References body, and HttpResponse().
| std::string ascii_query::HttpResponse::serialize | ( | ) | const |
Serialize response to HTTP/1.1 format.
Definition at line 62 of file http_server.cpp.
References body, headers, status_code, and status_text.
|
inlinestatic |
Definition at line 131 of file http_server.h.
References ascii_query::json::escape(), and HttpResponse().
|
inline |
|
inlinestatic |
| std::string ascii_query::HttpResponse::body |
Definition at line 98 of file http_server.h.
Referenced by html(), json(), ok(), serialize(), and text().
| std::unordered_map<std::string, std::string> ascii_query::HttpResponse::headers |
Definition at line 97 of file http_server.h.
Referenced by HttpResponse(), serialize(), and setHeader().
| int ascii_query::HttpResponse::status_code = 200 |
Definition at line 95 of file http_server.h.
Referenced by serialize().
| std::string ascii_query::HttpResponse::status_text = "OK" |
Definition at line 96 of file http_server.h.
Referenced by serialize().