Hi,
I use casablanca to build a cpp rest client. Recently we need to replace all http requests with https requests. So I simply changed the "http" in the following code to "https":
thanks very much!
I use casablanca to build a cpp rest client. Recently we need to replace all http requests with https requests. So I simply changed the "http" in the following code to "https":
//vistit https://api.dropbox.com/1/account/info
http_client_config config1;
credentials cred = credentials(U("ADMIN"),U("ADMIN"));
config1.set_credentials(cred);
http_client session(U("https://api.dropbox.com"), config1);
http_request request;
std::string requestBody = "{\"abc\" : \"efg\"}";
request.set_method(methods::POST);
request.set_request_uri(uri(U("/1/account/info")));
request.set_body(requestBody, L"application/json");
try
{
http_response response = session.request(request).get();
}
catch(std::exception& e)
{
printf(e.what());
}
I downloaded the lastest source code on the official website to run the above query. an exception is thrown at the try clause, and it prints "error in WinHttpSendRequest" I'm wondering what is the cause of this problem? My code works for non-http situations.thanks very much!