7 for (
const auto& header : response->headers) {
8 KURLYK_PRINT << header.first <<
": " << header.second << std::endl;
12 <<
"Request complete:" << std::endl
13 <<
"Ready: " << response->ready << std::endl
14 <<
"Content: " << response->content << std::endl
15 <<
"Error Code: " << response->error_code << std::endl
16 <<
"Status Code: " << response->status_code << std::endl
17 <<
"----------------------------------------" << std::endl;
26 KURLYK_PRINT <<
"Sending request with direct URL..." << std::endl;
33 KURLYK_PRINT <<
"Sending request using QueryParams..." << std::endl;
35 {
"category",
"linear"},
36 {
"symbol",
"ETHPERP"},
void print_response(const kurlyk::HttpResponsePtr &response)
A client class for making HTTP requests to a specific host.
void set_rate_limit_rps(long requests_per_second, RateLimitType type=RateLimitType::RL_GENERAL)
Sets the rate limit based on requests per second (RPS).
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.