C++ edjLibrary SDK
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
edjx::request::HttpRequest Struct Reference

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::HttpHeadersget_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...
 

Detailed Description

Request, which may include version, body, headers, method, and URL.

Constructor & Destructor Documentation

◆ HttpRequest()

edjx::request::HttpRequest::HttpRequest ( )
inline

Creates an empty request object with HTTP version set to HTTP/1.1, HTTP method of NONE, and no body.

Member Function Documentation

◆ from_client()

static edjx::error::HttpError edjx::request::HttpRequest::from_client ( HttpRequest result)
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.

Parameters
resultHttpRequest in which the request will be stored
Returns
Returns edjx::error::HttpError::Success on success, some other value if execution failed.

◆ get_headers()

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.

Returns
Request headers

◆ get_method()

http::HttpMethod edjx::request::HttpRequest::get_method ( ) const

Returns the HTTP method of the request.

Returns
HTTP method of the request

◆ get_uri()

http::Uri edjx::request::HttpRequest::get_uri ( ) const

Returns the URL from the request.

Returns the request URL value as [edjx::http::Uri] object.

Returns
URL of the request

◆ open_read_stream()

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.

Parameters
resultHTTP request body read stream
Returns
Returns edjx::error::HttpError::Success on success, some other value on failure.

◆ read_body()

edjx::error::HttpError edjx::request::HttpRequest::read_body ( std::vector< uint8_t > &  result)

Fetches the request body and returns the body as bytes.

Parameters
resultReceived body bytes will be stored here.
Returns
Returns edjx::error::HttpError::Success on success, some other value on failure.

Member Data Documentation

◆ headers

edjx::http::HttpHeaders edjx::request::HttpRequest::headers

HTTP headers of the request.

◆ initialized

bool edjx::request::HttpRequest::initialized

Whether this object has been initialized or not.

◆ method

http::HttpMethod edjx::request::HttpRequest::method

HTTP method of the request.

◆ uri

http::Uri edjx::request::HttpRequest::uri

URL of the request.

◆ version

http::HttpVersion edjx::request::HttpRequest::version

HTTP version of the request.


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