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
Description
If you are using the brand new symfony http client, and the request fails for some reasons (e.g a 400 or a 500 is returned), instead of having a neat http client exception stating that we had a 400 or a 500, we have a TransportException with an obscure curl error message (failed writing headers).
If we add a call to getStatusCode, the exception disappear (as expected). This seems to happen only with a request returning a body within the response with the status code and currently I managed to reproduce it only with a application/json content type.
…onse (nicolas-grekas)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] correctly clean state on destruct in CurlResponse
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30753
| License | MIT
| Doc PR | -
On destruct, we ask curl to close the stream once the headers arrived, but we don't silence the "error" this sets in curl. This fixes it.
Commits
-------
332a88c [HttpClient] correctly clean state on destruct in CurlResponse
Symfony version(s) affected: master / 4.3
Description
If you are using the brand new symfony http client, and the request fails for some reasons (e.g a 400 or a 500 is returned), instead of having a neat http client exception stating that we had a 400 or a 500, we have a
TransportException
with an obscure curl error message (failed writing headers
).If we add a call to
getStatusCode
, the exception disappear (as expected). This seems to happen only with a request returning a body within the response with the status code and currently I managed to reproduce it only with aapplication/json
content type.How to reproduce
See my reproducer : https://gist.github.com/Taluu/50aa950b4fcfd5997f69e1d11ead6cdf
Possible Solution
No idea. :D
The text was updated successfully, but these errors were encountered: