[HttpClient] Handle requests with null body#45566
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. |
nicolas-grekas
left a comment
There was a problem hiding this comment.
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
bodyparameters leads to an exception (which breaks async-aws)In curl client:
nullis not a string andself::readRequestBodyexpects a closure.symfony/src/Symfony/Component/HttpClient/CurlHttpClient.php
Lines 214 to 221 in 08fa74a
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"".