I'm calling a REST WS with a JSON payload to subscribe certains events. The server answer with HTTP-Code 201 and a field named Location in the HTTP-Header with the ID of the subscription.
As an example, in curl (-v) we get:
[...]
< HTTP/1.1 201 Created
< Connection: Keep-Alive
< Content-Length: 0
< Location: /v2/subscriptions/5ab386ad4bf6feec37ffe44d
[...]
In C++ using curlpp we want to retrieve that id looking at the response header. Now we have only the body response (in this case empty).
std::ostringstream response;
subRequest.setOpt(new curlpp::options::WriteStream(&response));
// Send request and get a result.
subRequest.perform();
cout << response.str() << endl;
How can we obtain the Location header's field (whose content in the example is "/v2/subscriptions/5ab386ad4bf6feec37ffe44d") in C++ using curlpp?