Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jderusse commentedFeb 26, 2022
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 |
nicolas-grekas commentedFeb 26, 2022
nicolas-grekas commentedFeb 26, 2022
Here is what I'd like to try: |
jderusse commentedFeb 26, 2022
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:
|
nicolas-grekas commentedFeb 26, 2022
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. |
jderusse commentedFeb 26, 2022
go it.. PR updated. |
nicolas-grekas left a comment
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 to557ce67Compare557ce67 to39aec09Comparenicolas-grekas commentedFeb 27, 2022
Thank you@jderusse. |
nicolas-grekas commentedFeb 27, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I changed the approach a bit in65609d8 FYI |
Uh oh!
There was an error while loading.Please reload this page.
since#45527 passing null to the
bodyparameters leads to an exception (whichbreaks async-aws)In curl client:
nullis not a string andself::readRequestBodyexpects a closure.symfony/src/Symfony/Component/HttpClient/CurlHttpClient.php
Lines 214 to 221 in08fa74a
In NativeClient,
getBodyAsStringwill fail to returnnullbecause of thestringreturn 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 thebodyparameters and converts nulls to"".