Skip to content

Conversation

@PowerKiKi
Copy link
Contributor

I've realized that PR #202 was probably a mistake and should be reversed. The fact that $request->getParsedBody() might be empty was due to an incorrect use of Zend Expressive. And I now think that it is not, and should not be, the responsibility of graphql-php to parse a PSR-7 request.

I've since updated my code to properly configure Zend Expressive to parse the request with BodyParamsMiddleware before reaching graphql-php.

If we don't merge this PR, then suddenly graphql-php will have to re-implement all kind of request parsing method (i'm thinking multipart/form-data) just in case the request was not parsed beforehand. And that would probably not be something we would like to have in that project. Instead it should live in a different project specialized in request parsing.

This revert webonyx#202 (commit 9d37f4c) because trying to parse PSR-7 request
was a mistake. The whole point of PSR-7 is to allow for interoperability
and be able to use specialized libs for body parsing (amongst many other
things). Trying to parse ourselves would be opening a can of worm if/when
other content types have to be supported. It is more correct and future
safe to require that the body is parsed before being passed to GraphQL.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.877% when pulling 178b179 on PowerKiKi:no-parsing into a3f18b5 on webonyx:master.

@vladar
Copy link
Member

vladar commented Dec 21, 2017

It introduces a possible breaking change, so we'll have to release it in the next major version. Will merge it as soon as I start working on it (unless you need it for your other PRs).

@PowerKiKi
Copy link
Contributor Author

I will most likely need it for the next PR, but let's wait and re-consider it when I have something more to share...

@vladar
Copy link
Member

vladar commented Jan 1, 2018

So when we merge uploads this PR will make no sense, right?

@PowerKiKi
Copy link
Contributor Author

The upload PR does include this PR's commit too, so yes if upload PR is merged, then this one becomes useless. But it could also be merged separately... depending on how long it takes for upload PR to be merged...

@vladar vladar merged commit 918bbff into webonyx:master Jan 13, 2018
@PowerKiKi PowerKiKi deleted the no-parsing branch April 15, 2018 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants