mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-17 14:25:37 +00:00
Set headers for GET.
This commit is contained in:
@@ -173,11 +173,17 @@ int64_t TracyLlmApi::GetRequest( const std::string& url, std::string& response )
|
||||
assert( m_curl );
|
||||
response.clear();
|
||||
|
||||
curl_slist *hdr = nullptr;
|
||||
hdr = curl_slist_append( hdr, "Accept: application/json" );
|
||||
hdr = curl_slist_append( hdr, "Content-Type: application/json" );
|
||||
|
||||
curl_easy_setopt( m_curl, CURLOPT_URL, url.c_str() );
|
||||
curl_easy_setopt( m_curl, CURLOPT_HTTPHEADER, hdr );
|
||||
curl_easy_setopt( m_curl, CURLOPT_WRITEDATA, &response );
|
||||
curl_easy_setopt( m_curl, CURLOPT_WRITEFUNCTION, WriteFn );
|
||||
|
||||
auto res = curl_easy_perform( m_curl );
|
||||
curl_slist_free_all( hdr );
|
||||
if( res != CURLE_OK ) return -1;
|
||||
|
||||
int64_t http_code = 0;
|
||||
|
||||
Reference in New Issue
Block a user