-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
Support non-JSON ServerRequestInterface #1004
Conversation
Please add a test to ensure this actually fixes a reproducible issue and we do not cause a regression later. |
Codecov Report
@@ Coverage Diff @@
## master #1004 +/- ##
============================================
+ Coverage 94.24% 94.49% +0.24%
Complexity 50 50
============================================
Files 117 120 +3
Lines 9686 9635 -51
============================================
- Hits 9129 9105 -24
+ Misses 557 530 -27
Continue to review full report at Codecov.
|
c4c2765
to
56d3d98
Compare
Thanks for the feedback, I updated the code as requested. I actually had an issue using Symfony's Although this could be perceived as an issue on Symfony's side, considering that, in the case of an URL-encoded body:
, I guess this behavior is nevertheless considered pretty standard, isn't it? Lastly, in order to support these inconsistencies between if ($request instanceof ServerRequestInterface) {
$bodyParams = $request->getParsedBody();
}
$bodyParams ??= $this->decodeContent((string) $request->getBody(), $contentType[0]); Would that be preferable? |
If you can create a test case that fails with the current implementation and passes with that one, sure. |
Thanks for the PR and the thorough tests |
Hello @spawnia, do you have some insight regarding when this could be part of a new release, by any chance? We will need this fix for our package thecodingmachine/graphqlite-bundle. If it's not something we can expect in the near future (which I would totally understand, I don't mean to push my personal agenda), I guess we could implement some temporary fix on our side. I'd still prefer not to if it's something we can avoid, though. |
(cherry picked from commit dcb3a7e)
Backported and releaed with https://github.com/webonyx/graphql-php/releases/tag/v14.11.2 |
Nice, thank you very much! |
In #598, use of
ServerRequestInterface::getParsedBody()
has been replaced with inlined parsing ofRequestInterface::getBody()
.Later, it has been reintroduced (cf. #715), but for JSON requests only.
Therefore, this Pull Request aims to restore use of
getParsedBody()
when available, in fallback case as well (commonlyapplication/x-www-form-urlencoded
).