Value-type description of a request; pass to Client::async_perform.
More...
#include <cofetch.h>
|
| | Request (std::string url) |
| |
| Request & | method (Method m) |
| |
| Request & | headers (std::vector< std::string > h) |
| |
| Request & | body (std::string b) |
| |
| Request & | timeout (std::chrono::milliseconds t) |
| | Whole-transfer timeout (default 5s), millisecond resolution.
|
| |
| Request & | follow_redirects (long max=30) |
| | Follow HTTP 3xx redirects, at most max hops (the transfer fails with CURLE_TOO_MANY_REDIRECTS beyond that).
|
| |
| Request & | curl (std::function< void(CURL *)> fn) |
| | Escape hatch: fn runs on the underlying easy handle after cofetch's own options, so it can set (or override) any CURLOPT_*.
|
| |
Value-type description of a request; pass to Client::async_perform.
◆ Method
| Enumerator |
|---|
| GET | |
| POST | |
| PUT | |
| PATCH | |
| DEL | |
◆ Request()
| cofetch::Request::Request |
( |
std::string |
url | ) |
|
|
inlineexplicit |
◆ body()
| Request & cofetch::Request::body |
( |
std::string |
b | ) |
|
|
inline |
◆ curl()
| Request & cofetch::Request::curl |
( |
std::function< void(CURL *)> |
fn | ) |
|
|
inline |
Escape hatch: fn runs on the underlying easy handle after cofetch's own options, so it can set (or override) any CURLOPT_*.
The handle is scrubbed with curl_easy_reset before returning to the reuse pool, so options set here never leak into later requests.
◆ follow_redirects()
| Request & cofetch::Request::follow_redirects |
( |
long |
max = 30 | ) |
|
|
inline |
Follow HTTP 3xx redirects, at most max hops (the transfer fails with CURLE_TOO_MANY_REDIRECTS beyond that).
Off by default.
◆ headers()
| Request & cofetch::Request::headers |
( |
std::vector< std::string > |
h | ) |
|
|
inline |
◆ method()
◆ timeout()
| Request & cofetch::Request::timeout |
( |
std::chrono::milliseconds |
t | ) |
|
|
inline |
Whole-transfer timeout (default 5s), millisecond resolution.
Note libcurl's stock DNS resolver still rounds the name-resolution phase up to whole seconds.
◆ body_
| std::string cofetch::Request::body_ |
◆ curl_setup_
| std::function<void(CURL*)> cofetch::Request::curl_setup_ |
◆ headers_
| std::vector<std::string> cofetch::Request::headers_ |
◆ max_redirects_
| long cofetch::Request::max_redirects_ = 0 |
◆ method_
◆ timeout_
| std::chrono::milliseconds cofetch::Request::timeout_ {std::chrono::seconds{5}} |
◆ url_
| std::string cofetch::Request::url_ |
The documentation for this class was generated from the following file: