7 <<
"Response received:" << std::endl
8 <<
"Ready: " << response->ready << std::endl
9 <<
"Content: " << response->content << std::endl
10 <<
"Error Code: " << response->error_code << std::endl
11 <<
"Status Code: " << response->status_code << std::endl
12 <<
"----------------------------------------" << std::endl;
24 KURLYK_PRINT <<
"Sending the first GET request..." << std::endl;
29 if (response->ready && response->status_code == 200) {
30 KURLYK_PRINT <<
"First request succeeded. Sending the second request..." << std::endl;
35 KURLYK_PRINT <<
"Second request completed." << std::endl;
39 KURLYK_PRINT <<
"First request failed. Not sending the second request." << std::endl;
A client class for making HTTP requests to a specific host.
void set_verbose(bool verbose)
Enables or disables verbose output.
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 cancel_requests()
Cancels the active request associated with this client and waits for its completion.
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.
void print_response(const kurlyk::HttpResponsePtr &response)