-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using sessions, the body/payload/multipart of the previous request is sent if not replaced. #1171
Comments
I did some testing and have two observations:
I started modifying the test server so it always responds with some (base64 encoded?) json that contains information on what the request looked like to the server (all headers listed + full body). For tests that need to receive a custom message as well, that could also be placed in the json in a node, e.g. "userData". Leading to:
But since this requires some work, I'd want to hear your opinion on this first. |
@simue thanks for reporting and looking into this! Yes, a clear What do you think about this? |
I like the approach you suggested and implemented it in #1179. I consider this a bugfix for 1.11. Since for other PRs you seem to be working towards 1.12.0 - are you open to do another 1.11.x bugfix release? |
Description
I am using a session to send multiple sequential requests. Some are GET, some are POST.
On a GET that is sent after a POST, I see that the
content_
of the first request being used as custom method, see example below.I'd expect the session to either internally reset
content_
(maybe inmakeRequest
?), or if not possible, I'd expect there to be the possibility of resettingcontent_
explicitly.Since
content_
's default is std::monostate, I'd like to introduce a reset function, setting std::monostate.Interestingly enough, there already is a function
hasBodyOrPayload
which generates a custom GET request and a comment stating GET with body is illegal. But no setter/reset forcontent_
.Example/How to Reproduce
cpr::Session
Possible Fix
See above, I'd like to introduce a reset function for
content_
.Where did you get it from?
conan
Additional Context/Your Environment
The text was updated successfully, but these errors were encountered: