#include <cofetch.h>
|
| | Response ()=default |
| |
| | Response (CURLcode curl_code, long http_code, std::string data, std::string header_data) |
| |
| bool | is_ok () const |
| | True when the transfer succeeded and the HTTP status is 2xx.
|
| |
| const char * | error () const |
| | Human readable description of the transport error ("No error" when the transfer itself succeeded).
|
| |
| Headers | headers () const |
| | Parse header_data_ into a case-insensitive name->value map.
|
| |
| std::optional< std::string > | header (std::string_view name) const |
| | Case-insensitive lookup of one field without building the full map; repeats are comma-combined.
|
| |
- Examples
- example_compression.cpp, example_concurrent.cpp, example_errors.cpp, example_fluent.cpp, example_future.cpp, example_hello.cpp, example_http2.cpp, example_reactors.cpp, example_redirects.cpp, example_sync.cpp, and example_tls.cpp.
◆ Headers
◆ Response() [1/2]
| cofetch::Response::Response |
( |
| ) |
|
|
default |
◆ Response() [2/2]
| cofetch::Response::Response |
( |
CURLcode |
curl_code, |
|
|
long |
http_code, |
|
|
std::string |
data, |
|
|
std::string |
header_data |
|
) |
| |
|
inline |
◆ error()
| const char * cofetch::Response::error |
( |
| ) |
const |
|
inline |
Human readable description of the transport error ("No error" when the transfer itself succeeded).
◆ header()
| std::optional< std::string > cofetch::Response::header |
( |
std::string_view |
name | ) |
const |
|
inline |
Case-insensitive lookup of one field without building the full map; repeats are comma-combined.
std::nullopt when the field is absent.
◆ headers()
| Headers cofetch::Response::headers |
( |
| ) |
const |
|
inline |
Parse header_data_ into a case-insensitive name->value map.
Repeated fields are comma-combined (RFC 9110 ยง5.3). Parsed on demand and not cached: keep the result if you read it repeatedly, and for a single field prefer header(), which skips building the whole map. When redirects are followed, header_data_ (and this map) spans every hop.
◆ is_ok()
| bool cofetch::Response::is_ok |
( |
| ) |
const |
|
inline |
◆ curl_code_
| CURLcode cofetch::Response::curl_code_ = CURLE_OK |
◆ data_
| std::string cofetch::Response::data_ |
◆ header_data_
| std::string cofetch::Response::header_data_ |
◆ http_code_
| long cofetch::Response::http_code_ = 0 |
The documentation for this class was generated from the following file: