WebFramework v3.0.12
Web framework for C++.
|
HTTPBuilder wrapper. More...
#include <HTTPResponse.h>
Public Member Functions | |
HTTPResponse & | operator= (const web::HTTPBuilder &builder) |
Assign operator for HTTPBuilder. | |
void | setHTTPVersion (const std::string &version) |
void | setResponseCode (web::responseCodes code) |
Set HTTP response code. | |
void | addHeader (const std::string &name, const std::string &value) |
Set additional HTTP header. | |
void | addBody (const std::string &body) |
void | addBody (const json::JSONBuilder &json) |
void | addBody (std::string &&body) noexcept |
HTTPResponse & | appendBody (const std::string &body) |
void | addCookie (const std::string &name, const std::string &value) |
Add cookie to HTTP response. | |
void | setDefault () |
Clears HTTPResponse. | |
void | setIsValid (bool isValid) |
operator bool () const | |
Static Public Member Functions | |
static std::string | getFullDate () |
Adds full date GMT to response. | |
Friends | |
streams::IOSocketStream & | operator<< (streams::IOSocketStream &stream, HTTPResponse &response) |
Sending HTTPResponse through network. | |
HTTPBuilder wrapper.
Overriding output stream operator for simplify HTTP response sending
Definition at line 14 of file HTTPResponse.h.
framework::HTTPResponse::HTTPResponse | ( | ) |
Definition at line 12 of file HTTPResponse.cpp.
void framework::HTTPResponse::addBody | ( | const json::JSONBuilder & | json | ) |
Some JSON data with HTTP response
Content-Length and Content-Type headers setting automatically
json | JSON data |
Definition at line 47 of file HTTPResponse.cpp.
void framework::HTTPResponse::addBody | ( | const std::string & | body | ) |
Some data with HTTP response
Content-Length header setting automatically
body | data |
|
noexcept |
Some data with HTTP response
Content-Length header setting automatically
body | data |
void framework::HTTPResponse::addCookie | ( | const std::string & | name, |
const std::string & | value ) |
Add cookie to HTTP response.
name | of cookie |
value | of cookie |
Definition at line 69 of file HTTPResponse.cpp.
void framework::HTTPResponse::addHeader | ( | const std::string & | name, |
const std::string & | value ) |
Set additional HTTP header.
name | of HTTP header |
value | of HTTP header |
Definition at line 34 of file HTTPResponse.cpp.
HTTPResponse & framework::HTTPResponse::appendBody | ( | const std::string & | body | ) |
Some data with HTTP response
Content-Length header setting automatically
body | data |
Definition at line 62 of file HTTPResponse.cpp.
|
static |
Adds full date GMT to response.
Definition at line 7 of file HTTPResponse.cpp.
|
explicit |
isValid getter
Definition at line 93 of file HTTPResponse.cpp.
HTTPResponse & framework::HTTPResponse::operator= | ( | const web::HTTPBuilder & | builder | ) |
Assign operator for HTTPBuilder.
builder | your HTTPBuilder |
Definition at line 17 of file HTTPResponse.cpp.
void framework::HTTPResponse::setDefault | ( | ) |
Clears HTTPResponse.
Definition at line 77 of file HTTPResponse.cpp.
void framework::HTTPResponse::setHTTPVersion | ( | const std::string & | version | ) |
Set HTTP version
Default is HTTP/1.1
version | full HTTP version like HTTP/1.1 |
Definition at line 24 of file HTTPResponse.cpp.
void framework::HTTPResponse::setIsValid | ( | bool | isValid | ) |
Definition at line 88 of file HTTPResponse.cpp.
void framework::HTTPResponse::setResponseCode | ( | web::responseCodes | code | ) |
Set HTTP response code.
code | value from web::responseCodes |
Definition at line 29 of file HTTPResponse.cpp.
|
friend |
Sending HTTPResponse through network.
stream | special class for sending data through network |
response | class instance |
web::WebException |
Definition at line 98 of file HTTPResponse.cpp.