Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: Read data from response into memory

$
0
0
Hi Akshat,

In our 1.1.0 release we fixed an issue making an improvement to how we store and organize header files. Now our header files are located in a subfolder. So for example for the http_client.h you should now use:
#include <cpprest/http_client.h>
As far as examples for using extract_vector, it is fairly straightforward. You can take a look at the test cases we have for the extract_* methods as well in response_extract_tests.cpp. Here is a quick snippet as well that I just put together.
http_client client(U("http://myserver"));
client.request(methods::GET).then([](http_response response) -> pplx::task<std::vector<unsigned char>>
{
    return response.extract_vector();
}).then([](std::vector<unsigned char> responseBody)
{
    // TODO - Process the response body here.
})
// Waiting for everything to complete.
// This is blocking so depending on our application and circumstance this might not be a good idea.
.wait();
Steve

Viewing all articles
Browse latest Browse all 4845

Trending Articles