The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
7.96k
stars
1.65k
forks
source link
Retry a http request without getting request body data purged #1674
The args... gave us the flexibility as web::http::client::http_client::request() supports multiple parameter sets so that we can use one function to send our requests to all the different services.
Previously, we are calling request(method, path_query, body) to one of the services and cpprestsdk will wrap them into a http_request struct in each retry. That works.
But now we need to add headers to our request. It forces us to wrap all the paraments to a http_request struct for the args... we passed to cpprestsdk, since web::http::client::http_client::request() does not support header key and value inputs.
And our problem is, once the request body data has been loaded to the http_request struct, looks like it can be used only once and once the request is sent, the data will be purged as this issue points out. So for each following retry request, the request body in the request struct appears to be null.
Does cpprestsdk support any methods to keep the request data for next retry requests, or accept header inputs for the request calls?
We are using cpprestsdk to compose and send http requests to other services. We applied a retry logic to it in form of
The
args...
gave us the flexibility asweb::http::client::http_client::request()
supports multiple parameter sets so that we can use one function to send our requests to all the different services.Previously, we are calling
request(method, path_query, body)
to one of the services and cpprestsdk will wrap them into a http_request struct in each retry. That works.But now we need to add headers to our request. It forces us to wrap all the paraments to a
http_request
struct for theargs...
we passed to cpprestsdk, sinceweb::http::client::http_client::request()
does not support header key and value inputs. And our problem is, once the request body data has been loaded to thehttp_request
struct, looks like it can be used only once and once the request is sent, the data will be purged as this issue points out. So for each following retry request, the request body in the request struct appears to benull
.Does cpprestsdk support any methods to keep the request data for next retry requests, or accept header inputs for the request calls?