NetFlex  0.0.0
C++11 HTTP Server Library.
Public Member Functions | List of all members
netflex::http::response Class Reference

#include <response.hpp>

Public Member Functions

 response (void)
 default ctor
 
 ~response (void)=default
 default dtor
 
 response (const response &)=default
 copy ctor
 
responseoperator= (const response &)=default
 assignment operator
 
const std::string & get_http_version (void) const
 
unsigned int get_status_code (void) const
 
const std::string & get_reason_phase (void) const
 
void set_http_version (const std::string &version)
 
void set_status_code (unsigned int code)
 
void set_reason_phrase (const std::string &reason)
 
const header_list_t & get_headers (void) const
 
void add_header (const header &header)
 
void set_headers (const header_list_t &headers)
 
const std::string & get_body (void) const
 
void set_body (const std::string &body)
 
std::string to_http_packet (void) const
 

Detailed Description

http response representation contains all information related to the http response to be sent

Member Function Documentation

◆ add_header()

void netflex::http::response::add_header ( const header header)

add a header to the headers list to be returned to the client if the header already exists, override it

Parameters
headerheader to be added

◆ get_body()

const std::string& netflex::http::response::get_body ( void  ) const
Returns
response body

◆ get_headers()

const header_list_t& netflex::http::response::get_headers ( void  ) const
Returns
headers list of the http response

◆ get_http_version()

const std::string& netflex::http::response::get_http_version ( void  ) const
Returns
http version

◆ get_reason_phase()

const std::string& netflex::http::response::get_reason_phase ( void  ) const
Returns
reason phrase for status code

◆ get_status_code()

unsigned int netflex::http::response::get_status_code ( void  ) const
Returns
status code

◆ set_body()

void netflex::http::response::set_body ( const std::string &  body)

set response body to be returned to the client

Parameters
bodynew body to be returned

◆ set_headers()

void netflex::http::response::set_headers ( const header_list_t &  headers)

set a headers list to be used for the http response

Parameters
headersheaders list for http response

◆ set_http_version()

void netflex::http::response::set_http_version ( const std::string &  version)

set the http version used for the response

Parameters
versionhttp version

◆ set_reason_phrase()

void netflex::http::response::set_reason_phrase ( const std::string &  reason)

set reason phrase

Parameters
reasonreason phrase to return to the client

◆ set_status_code()

void netflex::http::response::set_status_code ( unsigned int  code)

set response status code

Parameters
codestatus code to return to the client

◆ to_http_packet()

std::string netflex::http::response::to_http_packet ( void  ) const

convert response to http packet

Returns
conversion

The documentation for this class was generated from the following file: