-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Psr18Client
can't get custom HTTP status messages
#51527
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
Comments
The HTTP status text is a thing of the past, HTTP/2 doesn't support it. I'd recommend not relying on this. |
and Symfony Client still supports that. the problem its that this one API doesn't have a meaningful body to be parsed on exceptions. |
Up for sending a PR? |
i will try to make a fix for Psr18Client next week |
Psr18Client
can't get custom HTTP status messages
Don't forget about this one @Hanmac ; |
yeah! thanks for reminding me, i probably can work on this the next days |
Symfony version(s) affected
5,4, 6.4
Description
for example if some API i want to connect uses HTTP Status Codes like this:
then when using Symfony HttpClient as its own Client, then the Exception sets the Message correct
but the Psr18Client doesn't parse the
response_headers
like the Exceptions dohttps://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpClient/Exception/HttpExceptionTrait.php#L34
the Psr18Client sets the status code without trying to set the message too:
https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/HttpClient/Psr18Client.php#L108
How to reproduce
have an API with custom status messages:
Possible Solution
Similar code that is done in the Exception Trait should also be done in the Psr18Client
Additional Context
No response
The text was updated successfully, but these errors were encountered: