-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Psr18Client: parse HTTP Reason Phrase for Response #52329
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
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
Hey! Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "6.4 for features / 5.4 or 6.3 for bug fixes". Cheers! Carsonbot |
It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you. Cheers! Carsonbot |
How does this behave when the actual request is done with HTTP/2, which does not transmit a reason phrase ? |
the Regex shouldn't find any, and then return nothing, and then the factory should fallback to the old one |
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.
Thanks for the PR, here are some comments.
I think HttplugClient
might need the same, can you have a look?
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
Where can I check this right now? I didn't saw it when making this MR |
I'm not sure this checkbox exists for PRs sent from a fork owned by an organization instead of a user. |
i probably need to do some trickery with while the Response class allows the Reason Phase to be null (and falls back to the hard codes ones, MAYBE) so i probably need to do something like: $responseParameters = [$response->getStatusCode()];
if ($phrase = $this->getReasonPhrase($response)) {
$responseParameters []= $phrase;
}
$psrResponse = $this->responseFactory->createResponse(...$responseParameters); i need to try this after weekend |
Co-authored-by: Alexander M. Turek <me@derrabus.de>
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.
This test failure appears to be related.
1) Symfony\Component\HttpClient\Tests\Psr18ClientTest::testInvalidHeaderResponse
TypeError: Http\Discovery\Psr17Factory::createResponse(): Argument #2 ($reasonPhrase) must be of type string, null given, called in /home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Psr18Client.php on line 109
/home/runner/work/symfony/symfony/vendor/php-http/discovery/src/Psr17Factory.php:84
/home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Psr18Client.php:109
/home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php:101
That's why I said I need to at this maybe after weekend |
took my laptop to work on this thing ... see my idea above with the variable parameters |
The last failures seems to be unrelated? |
Thank you @Hanmac. |
…ponse (Hanmac) This PR was submitted for the 6.4 branch but it was squashed and merged into the 5.4 branch instead. Discussion ---------- [HttpClient] Psr18Client: parse HTTP Reason Phrase for Response | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #51527 | License | MIT Commits ------- 115a5a1 [HttpClient] Psr18Client: parse HTTP Reason Phrase for Response
Merged as 115a5a1 in 5.4 |
Edits were not possible because it was forked to an organization account. |
Uh oh!
There was an error while loading. Please reload this page.