C++ edjLibrary SDK
|
Request, which may include version, body, headers, method, and URL. More...
#include <request.hpp>
Public Member Functions | |
HttpRequest () | |
Creates an empty request object with HTTP version set to HTTP/1.1, HTTP method of NONE, and no body. More... | |
http::HttpMethod | get_method () const |
Returns the HTTP method of the request. More... | |
http::Uri | get_uri () const |
Returns the URL from the request. More... | |
const edjx::http::HttpHeaders & | get_headers () const |
Returns HTTP headers of the request. More... | |
edjx::error::HttpError | read_body (std::vector< uint8_t > &result) |
Fetches the request body and returns the body as bytes. More... | |
edjx::error::HttpError | open_read_stream (edjx::stream::ReadStream &result) |
Opens a read stream to read the request body. More... | |
Static Public Member Functions | |
static edjx::error::HttpError | from_client (HttpRequest &result) |
Returns the client request being handled by the serverless function. More... | |
Public Attributes | |
bool | initialized |
Whether this object has been initialized or not. More... | |
http::HttpVersion | version |
HTTP version of the request. More... | |
http::HttpMethod | method |
HTTP method of the request. More... | |
http::Uri | uri |
URL of the request. More... | |
edjx::http::HttpHeaders | headers |
HTTP headers of the request. More... | |
Request, which may include version, body, headers, method, and URL.
|
inline |
Creates an empty request object with HTTP version set to HTTP/1.1, HTTP method of NONE, and no body.
|
static |
Returns the client request being handled by the serverless function.
Normally, this method does not need to be used explicitly. EDJX sample [C++ Serverless Application
] (https://github.com/edjx/edjfunction-example-cpp) code file (main.cpp) uses this method to fetch HTTP Request.
result | HttpRequest in which the request will be stored |
const edjx::http::HttpHeaders & edjx::request::HttpRequest::get_headers | ( | ) | const |
Returns HTTP headers of the request.
Returns the map of headers in the request as a map of header names to a vector of header values.
http::HttpMethod edjx::request::HttpRequest::get_method | ( | ) | const |
Returns the HTTP method of the request.
http::Uri edjx::request::HttpRequest::get_uri | ( | ) | const |
Returns the URL from the request.
Returns the request URL value as [edjx::http::Uri
] object.
edjx::error::HttpError edjx::request::HttpRequest::open_read_stream | ( | edjx::stream::ReadStream & | result | ) |
Opens a read stream to read the request body.
read_body()
and open_read_stream()
cannot be used at the same time.
result | HTTP request body read stream |
edjx::error::HttpError edjx::request::HttpRequest::read_body | ( | std::vector< uint8_t > & | result | ) |
Fetches the request body and returns the body as bytes.
result | Received body bytes will be stored here. |
edjx::http::HttpHeaders edjx::request::HttpRequest::headers |
HTTP headers of the request.
bool edjx::request::HttpRequest::initialized |
Whether this object has been initialized or not.
http::HttpMethod edjx::request::HttpRequest::method |
HTTP method of the request.
http::Uri edjx::request::HttpRequest::uri |
URL of the request.
http::HttpVersion edjx::request::HttpRequest::version |
HTTP version of the request.