120 const std::string & header_name,
121 const std::string & value
134 const std::string & header_name,
135 const std::vector<std::string> & values
149 const std::string & header_name,
150 const std::string & value
This class represents a write stream.
Definition: stream.hpp:68
HttpError
Enum describing return values of functions that correspond to HTTP modules.
Definition: error.hpp:14
HttpVersion
Enum containing an HTTP version.
Definition: http.hpp:18
uint16_t HttpStatusCode
HTTP status code (e.g., value 200 means OK, value 404 means Not Found)
Definition: http.hpp:60
std::map< std::string, std::vector< std::string >, CaseInsensitiveKeys > HttpHeaders
A map of HttpHeaders where keys are case-insensitive header names.
Definition: http.hpp:54
An HTTP response which may include body, headers, and status code.
Definition: response.hpp:30
HttpResponse & set_status(edjx::http::HttpStatusCode status)
Sets the HTTP status code of the client response.
const std::vector< uint8_t > & get_body() const
Returns a constant reference to the body.
HttpResponse(const std::string &text)
Creates an HttpResponse for the client.
HttpResponse & append_header(const std::string &header_name, const std::string &value)
Sets a response header to the given value.
edjx::http::HttpVersion get_version() const
Returns the HTTP version of this response.
HttpResponse & set_version(edjx::http::HttpVersion version)
Sets the HTTP version of this response.
edjx::http::HttpVersion version
HTTP version.
Definition: response.hpp:34
edjx::http::HttpHeaders headers
HTTP headers.
Definition: response.hpp:36
HttpResponse(const uint8_t *mem, size_t size)
Creates an HttpResponse for the client.
edjx::http::HttpStatusCode get_status() const
Returns the HTTP status code of the response.
std::vector< uint8_t > body
Body of the response.
Definition: response.hpp:38
HttpResponse & set_body(const std::vector< uint8_t > &bytes)
Sets the body to be bytes.
edjx::error::HttpError send_streaming(edjx::stream::WriteStream &write_stream)
Sends the response to the client using streaming.
edjx::http::HttpStatusCode status
HTTP status code.
Definition: response.hpp:32
const edjx::http::HttpHeaders & get_headers() const
Returns a constant reference to the response header map.
HttpResponse()
Creates an HttpResponse for the client.
HttpResponse & set_body(const uint8_t *mem, size_t size)
Sets the body to contain size bytes from address mem.
HttpResponse(const std::vector< uint8_t > &bytes)
Creates an HttpResponse for the client.
HttpResponse & set_headers(const edjx::http::HttpHeaders &headers)
Set the response headers to the given values.
edjx::error::HttpError send()
Sends the response to the client.
HttpResponse & set_header(const std::string &header_name, const std::vector< std::string > &values)
Sets a response header to the given values.
HttpResponse & set_body(const std::string &text)
Sets the body to be text.
HttpResponse & set_header(const std::string &header_name, const std::string &value)
Sets a response header to the given value.