Open Lighting Architecture  Latest Git
Public Member Functions | List of all members
ola::http::HTTPResponse Class Reference

Public Member Functions

 HTTPResponse (struct MHD_Connection *connection)
 
void Append (const std::string &data)
 
void SetContentType (const std::string &type)
 Set the content-type header. More...
 
void SetHeader (const std::string &key, const std::string &value)
 Set a header in the response. More...
 
void SetStatus (unsigned int status)
 
void SetNoCache ()
 Set the appropriate headers so this response isn't cached.
 
void SetAccessControlAllowOriginAll ()
 Set the appropriate headers so this response is accessible from any origin.
 
int SendJson (const ola::web::JsonValue &json)
 Send a JsonObject as the response. More...
 
int Send ()
 Send the HTTP response. More...
 
struct MHD_Connection * Connection () const
 

Member Function Documentation

◆ Send()

int ola::http::HTTPResponse::Send ( )

Send the HTTP response.

Returns
true on success, false on error

◆ SendJson()

int ola::http::HTTPResponse::SendJson ( const ola::web::JsonValue json)

Send a JsonObject as the response.

Returns
true on success, false on error

◆ SetContentType()

void ola::http::HTTPResponse::SetContentType ( const std::string &  type)

Set the content-type header.

Parameters
typethe content type
Returns
true if the header was set correctly, false otherwise

◆ SetHeader()

void ola::http::HTTPResponse::SetHeader ( const std::string &  key,
const std::string &  value 
)

Set a header in the response.

Parameters
keythe header name
valuethe header value
Returns
true if the header was set correctly, false otherwise

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