Skip to content

Commit 36bb3ca

Browse files
authored
Error on SLIM 4
When performing any valid request error ```{"errors":[{"message":"GraphQL Request must include at least one of those two parameters: \"query\" or \"queryId\"","extensions":{"category":"request"}}]}``` is returned. I've narrowed this to $request->getParsedBody() returning empty array instead of null in slim 4 framework when parsed body is empty. This will fix this issue.
1 parent 4fe8fcb commit 36bb3ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Http/WebonyxGraphqlMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
7676
}
7777

7878
// Let's json deserialize if this is not already done.
79-
if ($request->getParsedBody() === null) {
79+
if (empty($request->getParsedBody())) {
8080
$content = $request->getBody()->getContents();
8181
$data = json_decode($content, true);
8282

0 commit comments

Comments
 (0)