HTTP response. More...
#include <response.hpp>
Classes | |
class | Builder |
HTTP response builder. More... |
Public Member Functions | |
Response () | |
Response (uint16_t code) | |
Response (const Response &res)=delete | |
Response (Response &&res) | |
virtual | ~Response () |
Response & | operator= (Response &&other) |
uint16_t | getStatus () const |
void | setStatus (uint16_t code) |
const anch::rest::Headers & | getHeaders () const |
void | setHeaders (const anch::rest::Headers &headers) |
std::string | getContentType () const |
void | setContentType (const std::string &contentType) |
template<typename T> | |
void | setBody (T body) |
void | writeBody (std::ostream &out) const |
Static Public Member Functions | |
static Builder | builder () |
HTTP response.
HTTP response representation
anch::rest::Response::Response | ( | ) |
Response default constructor
anch::rest::Response::Response | ( | uint16_t | code | ) |
Response constructor
code | the HTTP return code |
|
delete |
anch::rest::Response::Response | ( | Response && | res | ) |
|
virtual |
Response destructor
|
static |
Instanciate a new response builder for fluent API usage
std::string anch::rest::Response::getContentType | ( | ) | const |
Media type getter
const anch::rest::Headers & anch::rest::Response::getHeaders | ( | ) | const |
HTTP headers getter
uint16_t anch::rest::Response::getStatus | ( | ) | const |
HTTP status code getter
Move assignement
other | the Response to move |
void anch::rest::Response::setBody | ( | T | body | ) |
void anch::rest::Response::setContentType | ( | const std::string & | contentType | ) |
Media type getter
contentType | the media type to set |
void anch::rest::Response::setHeaders | ( | const anch::rest::Headers & | headers | ) |
HTTP headers setter.
This method will override every headers previously set.
void anch::rest::Response::setStatus | ( | uint16_t | code | ) |
HTTP status code setter
code | the status code to set |
void anch::rest::Response::writeBody | ( | std::ostream & | out | ) | const |
Write body on output stream
out | the output stream to write in |