One request, built fluently and run with send().
More...
#include <Client.hpp>
|
| RequestBuilder & | header (std::string name, std::string value) |
| |
| RequestBuilder & | body (std::string body, std::string content_type="text/plain") |
| | The body and, unless content_type is empty, its Content-Type.
|
| |
| RequestBuilder & | json (const nlohmann::json &value) |
| | A JSON body (Content-Type: application/json).
|
| |
| RequestBuilder & | cookie (std::string name, std::string value) |
| | A cookie for this request only, on top of the client's cookie jar.
|
| |
| RequestBuilder & | client_ip (std::string ip) |
| | The client address the application sees (default 127.0.0.1).
|
| |
| Response | send (std::chrono::milliseconds timeout=std::chrono::seconds(5)) |
| | Runs the request through the application and waits until the response is complete, or timeout passes (a coroutine handler still waiting, an endless SSE stream). Never throws for an application error: that is a 500 (or what on_error answers).
|
| |
One request, built fluently and run with send().
◆ RequestBuilder()
| orbit::testing::RequestBuilder::RequestBuilder |
( |
Client & |
client, |
|
|
http::HttpMethod |
method, |
|
|
std::string |
target |
|
) |
| |
|
private |
◆ body()
| RequestBuilder & orbit::testing::RequestBuilder::body |
( |
std::string |
body, |
|
|
std::string |
content_type = "text/plain" |
|
) |
| |
The body and, unless content_type is empty, its Content-Type.
◆ client_ip()
| RequestBuilder & orbit::testing::RequestBuilder::client_ip |
( |
std::string |
ip | ) |
|
The client address the application sees (default 127.0.0.1).
◆ cookie()
| RequestBuilder & orbit::testing::RequestBuilder::cookie |
( |
std::string |
name, |
|
|
std::string |
value |
|
) |
| |
A cookie for this request only, on top of the client's cookie jar.
◆ header()
| RequestBuilder & orbit::testing::RequestBuilder::header |
( |
std::string |
name, |
|
|
std::string |
value |
|
) |
| |
◆ json()
A JSON body (Content-Type: application/json).
◆ send()
| Response orbit::testing::RequestBuilder::send |
( |
std::chrono::milliseconds |
timeout = std::chrono::seconds(5) | ) |
|
Runs the request through the application and waits until the response is complete, or timeout passes (a coroutine handler still waiting, an endless SSE stream). Never throws for an application error: that is a 500 (or what on_error answers).
◆ Client
◆ body_
| std::string orbit::testing::RequestBuilder::body_ |
|
private |
◆ client_
| Client& orbit::testing::RequestBuilder::client_ |
|
private |
◆ client_ip_
| std::string orbit::testing::RequestBuilder::client_ip_ = "127.0.0.1" |
|
private |
◆ cookies_
| std::unordered_map<std::string, std::string> orbit::testing::RequestBuilder::cookies_ |
|
private |
◆ headers_
| std::vector<std::pair<std::string, std::string> > orbit::testing::RequestBuilder::headers_ |
|
private |
◆ method_
◆ target_
| std::string orbit::testing::RequestBuilder::target_ |
|
private |
The documentation for this class was generated from the following file: