On Mon, 23 May 2022, J via curl-library wrote:

       curl_easy_setopt( curl, CURLOPT_HEADER, "Content-Type:
application/x-www-form-urlencoded" );

       curl_easy_setopt( curl, CURLOPT_HEADER, ( (
(std::string)"Authorization: Bearer" ) + token ).c_str() );

These are wrong.

"CURLOPT_HEADER - pass headers to the data stream " this option is for asking for headers to (also) get sent to the write callback. See https://curl.se/libcurl/c/CURLOPT_HEADER.html

To tell libcurl HTTP headers to include in outgoing requests you want CURLOPT_HTTPHEADER: https://curl.se/libcurl/c/CURLOPT_HTTPHEADER.html

But note that you pass in a list of headers to that option, not a single one.

--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html
--
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to