-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Handle requests with null body #45566
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
Conversation
note: The signature of the
But from another hand, the same docblock says
One could think that So I believe #45527 is a BC break for |
Here is what I'd like to try: |
I'm not sure to understand: The first call to I believe the right solution is to have an internal technical default (not paramterizable) that fallbacks nulls to a specific value:
|
Actually not, because the first call always happens in the constructor. This call defines what you are looking for, this technical description of which values allow null. |
ae432f4
to
6561f9e
Compare
go it.. PR updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the init should be moved to mergeDefaultOptions, see failures.
👍 Otherwise. Maybe just rename $key to $k?
231621b
to
557ce67
Compare
557ce67
to
39aec09
Compare
Thank you @jderusse. |
I changed the approach a bit in 65609d8 FYI |
since #45527 passing null to the
body
parameters leads to an exception (which breaks async-aws)In curl client:
null
is not a string andself::readRequestBody
expects a closure.symfony/src/Symfony/Component/HttpClient/CurlHttpClient.php
Lines 214 to 221 in 08fa74a
In NativeClient,
getBodyAsString
will fail to returnnull
because of thestring
return type.Before #45527 null was converted to
""
thanks to the defaultOptions, but this is not the case anymore.In many places, we check if the body is
!== ""
but rarely check if the body is null, this PR restores the original behaviors for thebody
parameters and converts nulls to""
.