C++ edjLibrary SDK
Loading...
Searching...
No Matches
request.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <vector>
5#include <string>
6#include <map>
7
8#include "http.hpp"
9#include "stream.hpp"
10#include "error.hpp"
11
12namespace edjx {
13
19namespace request {
20
25 struct HttpRequest {
36
42 : initialized(false),
43 version(http::HttpVersion::HTTP_11),
44 method(http::HttpMethod::NONE) {}
45
46
61
68
77
87
95 edjx::error::HttpError read_body(std::vector<uint8_t> & result);
96
107 };
108
109}}
Class that represents a URL.
Definition: http.hpp:67
Read stream class.
Definition: stream.hpp:120
HttpError
Enum describing return values of functions that correspond to HTTP modules.
Definition: error.hpp:14
HttpVersion
Enum containing an HTTP version.
Definition: http.hpp:18
std::map< std::string, std::vector< std::string >, CaseInsensitiveKeys > HttpHeaders
A map of HttpHeaders where keys are case-insensitive header names.
Definition: http.hpp:54
HttpMethod
Enum containing a number of common HTTP methods.
Definition: http.hpp:29
Definition: error.hpp:5
Request, which may include version, body, headers, method, and URL.
Definition: request.hpp:25
const edjx::http::HttpHeaders & get_headers() const
Returns HTTP headers of the request.
http::HttpVersion version
HTTP version of the request.
Definition: request.hpp:29
http::HttpMethod get_method() const
Returns the HTTP method of the request.
HttpRequest()
Creates an empty request object with HTTP version set to HTTP/1.1, HTTP method of NONE,...
Definition: request.hpp:41
http::Uri uri
URL of the request.
Definition: request.hpp:33
edjx::error::HttpError read_body(std::vector< uint8_t > &result)
Fetches the request body and returns the body as bytes.
http::HttpMethod method
HTTP method of the request.
Definition: request.hpp:31
static edjx::error::HttpError from_client(HttpRequest &result)
Returns the client request being handled by the serverless function.
edjx::http::HttpHeaders headers
HTTP headers of the request.
Definition: request.hpp:35
bool initialized
Whether this object has been initialized or not.
Definition: request.hpp:27
edjx::error::HttpError open_read_stream(edjx::stream::ReadStream &result)
Opens a read stream to read the request body.
http::Uri get_uri() const
Returns the URL from the request.