You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a cpr::Session to perform multiple HTTP Requests.
At first I want to do a HTTP POST with a multipart parameter.
After that I want to do a simple GET.
It seems like cpr always performs a POST when a multipart parameter has been added to the session.
This is because the sessions prepareCommon adds the content to each request once it was set for the session.
cpr::Session session;
session.SetUrl( ... );
session.SetMultipart( ... );
session.Post( );
session.Get( ); <-- This is also a POST
Is this the desired beaviour?
Is there any workaround to remove the content from the session after the POST?
Example/How to Reproduce
Create a cpr::Session
Set Mulipart parameter
Perform POST
Perform GET
Possible Fix
No response
Where did you get it from?
GitHub (branch e.g. master)
Additional Context/Your Environment
OS: Linux
Version: 1.11.0
The text was updated successfully, but these errors were encountered:
@DanielRe1 thanks for reporting!
Sadly there is no way right now to clear the underlying std::variant<std::monostate, cpr::Payload, cpr::Body, cpr::Multipart> content_{std::monostate{}}; object back to std::monostate{}.
But what you could try is:
session.SetBody(cpr::Body{});
That way you at least clear the multipart.
Is this intended behaviour?
I'd say right now yes. But I would be open to merging a MR that adds a cpr::Session::ClearContent(); (or called differently) call to session.
Description
I'm using a
cpr::Session
to perform multiple HTTP Requests.At first I want to do a HTTP POST with a multipart parameter.
After that I want to do a simple GET.
It seems like
cpr
always performs a POST when a multipart parameter has been added to the session.This is because the sessions
prepareCommon
adds the content to each request once it was set for the session.Is this the desired beaviour?
Is there any workaround to remove the content from the session after the POST?
Example/How to Reproduce
cpr::Session
Possible Fix
No response
Where did you get it from?
GitHub (branch e.g. master)
Additional Context/Your Environment
The text was updated successfully, but these errors were encountered: