8 <<
"ready: " << response->ready << std::endl
9 <<
"response: " << std::endl
10 << response->content << std::endl
11 <<
"error_code: " << response->error_code << std::endl
12 <<
"status_code: " << response->status_code << std::endl
13 <<
"retry_attempt: " << response->retry_attempt << std::endl
14 <<
"connect_time: " << response->connect_time << std::endl
15 <<
"appconnect_time: " << response->appconnect_time << std::endl
16 <<
"pretransfer_time: " << response->pretransfer_time << std::endl
17 <<
"starttransfer_time: " << response->starttransfer_time << std::endl
18 <<
"total_time: " << response->total_time << std::endl
19 <<
"----------------------------------------" << std::endl;
32 std::string path =
"/delay/" + std::to_string(delay);
35 KURLYK_PRINT <<
"Sending delayed GET request with " << delay <<
" seconds delay..." << std::endl;
39 auto response = future_response.get();
42 KURLYK_PRINT <<
"Delayed request completed." << std::endl;
A client class for making HTTP requests to a specific host.
void set_connect_timeout(long connect_timeout)
Sets the connection timeout duration.
void set_retry_attempts(long retry_attempts, long retry_delay_ms)
Sets retry attempts and delay between retries for HTTP requests.
void set_timeout(long timeout)
Sets the timeout duration for HTTP requests.
void set_user_agent(const std::string &user_agent)
Sets the User-Agent header.
bool get(const std::string &path, const QueryParams &query, const Headers &headers, HttpResponseCallback callback)
Sends a GET request.
void print_response(const kurlyk::HttpResponsePtr &response)
Main header file for the Kurlyk library, providing HTTP and WebSocket support.
void init(const bool use_async=true)
Initializes the Kurlyk library, setting up necessary managers and the network worker.
std::unique_ptr< HttpResponse > HttpResponsePtr
A unique pointer to an HttpResponse object for memory management.
void deinit()
Deinitializes the Kurlyk library, stopping the network worker and releasing resources.
utils::CaseInsensitiveMultimap Headers
Alias for HTTP headers, providing a case-insensitive unordered multimap.
utils::CaseInsensitiveMultimap QueryParams
Alias for query parameters in HTTP requests, stored case-insensitively.