From 72a6aaa297dac1c39f0f4c02fbc941c552aeff16 Mon Sep 17 00:00:00 2001 From: Jake Booher Date: Tue, 3 Mar 2026 14:59:00 -0600 Subject: [PATCH 1/5] Example with breaking test --- tests/Unit/RequestParserTest.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/Unit/RequestParserTest.php b/tests/Unit/RequestParserTest.php index e8460fb..6c2f1bb 100644 --- a/tests/Unit/RequestParserTest.php +++ b/tests/Unit/RequestParserTest.php @@ -119,6 +119,29 @@ public function testPostWithBatchedRequest(): void self::assertSame($barQuery, $barParams->query); } + public function testPostWithBatchedRequestAndGetParams(): void + { + $fooQuery = /** @lang GraphQL */ '{ foo }'; + $barQuery = /** @lang GraphQL */ '{ bar }'; + $request = $this->makeRequest( + 'POST', + [], + [], + ['Content-Type' => 'application/json'], + \Safe\json_encode([ + ['query' => $fooQuery], + ['query' => $barQuery], + ]), + 'http://foo.bar/graphql?Operation=foo,bar' + ); + $params = (new RequestParser())->parseRequest($request); + + self::assertIsArray($params); + [$fooParams, $barParams] = $params; + self::assertSame($fooQuery, $fooParams->query); + self::assertSame($barQuery, $barParams->query); + } + public function testPostDefaultsToRegularForm(): void { $query = /** @lang GraphQL */ '{ foo }'; @@ -502,10 +525,10 @@ public function testMultipartFormWithNonJsonMap(): void * @param array $headers * @param string|resource|null $content */ - private function makeRequest(string $method, array $parameters = [], array $files = [], array $headers = [], $content = null): Request + private function makeRequest(string $method, array $parameters = [], array $files = [], array $headers = [], $content = null, $uri = 'http://foo.bar/graphql'): Request { $symfonyRequest = SymfonyRequest::create( - 'http://foo.bar/graphql', + $uri, $method, $parameters, [], From cf084d740c0380f60e8ef9902b32f1884bae95f6 Mon Sep 17 00:00:00 2001 From: Jake Booher Date: Tue, 3 Mar 2026 15:01:14 -0600 Subject: [PATCH 2/5] Fix for #24 --- src/RequestParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RequestParser.php b/src/RequestParser.php index dd4616f..450e551 100644 --- a/src/RequestParser.php +++ b/src/RequestParser.php @@ -63,7 +63,7 @@ protected function bodyParams(Request $request): array return ['query' => $request->getContent()]; } - $bodyParams = $request->input(); + $bodyParams = $request->post(); if (is_array($bodyParams) && count($bodyParams) > 0) { if (Arr::isAssoc($bodyParams)) { From f3f01ad4f8336d85615126686fa1329a4dd57f39 Mon Sep 17 00:00:00 2001 From: Jake Booher Date: Tue, 3 Mar 2026 15:02:18 -0600 Subject: [PATCH 3/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0fbc9f..76f9d97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support Laravel 13 https://github.com/laragraph/utils/pull/22 +- Fixes error when using GET parameters on batched queries https://github.com/laragraph/utils/issues/26 ## v2.2.0 From ddec2fc357b3923d35c9514651697ede135e9b6c Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Wed, 4 Mar 2026 08:12:26 +0100 Subject: [PATCH 4/5] Change uri parameter type to string in makeRequest --- tests/Unit/RequestParserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/RequestParserTest.php b/tests/Unit/RequestParserTest.php index 6c2f1bb..1a91f9c 100644 --- a/tests/Unit/RequestParserTest.php +++ b/tests/Unit/RequestParserTest.php @@ -525,7 +525,7 @@ public function testMultipartFormWithNonJsonMap(): void * @param array $headers * @param string|resource|null $content */ - private function makeRequest(string $method, array $parameters = [], array $files = [], array $headers = [], $content = null, $uri = 'http://foo.bar/graphql'): Request + private function makeRequest(string $method, array $parameters = [], array $files = [], array $headers = [], $content = null, string $uri = 'http://foo.bar/graphql'): Request { $symfonyRequest = SymfonyRequest::create( $uri, From b0f7709806f9337e95a5a4788d12f0a204241d42 Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Wed, 4 Mar 2026 08:13:58 +0100 Subject: [PATCH 5/5] Update CHANGELOG for version 2.3.1 Added release notes for version 2.3.1 including a fix for ignoring query parameters in non-GET requests. --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f9d97..19ae1ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## v2.3.1 + +### Fixed + +- Ignore query parameters in non-GET requests https://github.com/laragraph/utils/issues/26 + ## v2.3.0 ### Added - Support Laravel 13 https://github.com/laragraph/utils/pull/22 -- Fixes error when using GET parameters on batched queries https://github.com/laragraph/utils/issues/26 ## v2.2.0