casablanca

Set Basic HTTP Authentication in Casablanca

随声附和 提交于 2019-11-30 09:04:14
I'm trying to modify the Casablanca tutorial to include basic HTTP authentication to access the Prosper API : auto fileStream = std::make_shared<ostream>(); // Open stream to output file. auto requestTask = fstream::open_ostream(U("results.html")).then([=](ostream outFile) { *fileStream = outFile; // Create http_client to send the request. http_client_config config; credentials creds( "username", "password" ); config.set_credentials( creds ); http_client client( U( "https://api.prosper.com/" ), config ); // Build request URI and start the request. uri_builder builder(U("/api/Listings/"));

no suitable user-defined conversion from utility::string_t to std::string

不想你离开。 提交于 2019-11-30 04:56:38
问题 I am using the casablanca C++ Rest library to make HTTP requests. The problem is that this gives a utility::string_t string as output and I can't quite find any way to convert this to a classic std::string. Any ideas? client.request(methods::GET).then([](http_response response) { if(response.status_code() == status_codes::OK) { string_t s = response.extract_string().get(); } }); 回答1: If you see the documentation for C++ REST SDK from github, you'll find a typedef C++ Rest SDK - utility

Set Basic HTTP Authentication in Casablanca

别等时光非礼了梦想. 提交于 2019-11-29 13:33:56
问题 I'm trying to modify the Casablanca tutorial to include basic HTTP authentication to access the Prosper API: auto fileStream = std::make_shared<ostream>(); // Open stream to output file. auto requestTask = fstream::open_ostream(U("results.html")).then([=](ostream outFile) { *fileStream = outFile; // Create http_client to send the request. http_client_config config; credentials creds( "username", "password" ); config.set_credentials( creds ); http_client client( U( "https://api.prosper.com/" )