diff --git a/src/GraphQl/Action/EntrypointAction.php b/src/GraphQl/Action/EntrypointAction.php index dcdd4a1dfd8..f0b4eec54e4 100644 --- a/src/GraphQl/Action/EntrypointAction.php +++ b/src/GraphQl/Action/EntrypointAction.php @@ -86,15 +86,16 @@ private function parseRequest(Request $request): array return [$query, $operationName, $variables]; } - if ('json' === $request->getContentType()) { + $contentType = method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType(); + if ('json' === $contentType) { return $this->parseData($query, $operationName, $variables, $request->getContent()); } - if ('graphql' === $request->getContentType()) { + if ('graphql' === $contentType) { $query = $request->getContent(); } - if (\in_array($request->getContentType(), ['multipart', 'form'], true)) { + if (\in_array($contentType, ['multipart', 'form'], true)) { return $this->parseMultipartRequest($query, $operationName, $variables, $request->request->all(), $request->files->all()); } diff --git a/src/Serializer/SerializerContextBuilder.php b/src/Serializer/SerializerContextBuilder.php index b9de4952c3a..01b904e8cd3 100644 --- a/src/Serializer/SerializerContextBuilder.php +++ b/src/Serializer/SerializerContextBuilder.php @@ -72,7 +72,7 @@ public function createFromRequest(Request $request, bool $normalization, array $ } } - if ('csv' === $request->getContentType()) { + if ('csv' === (method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType())) { $context[CsvEncoder::AS_COLLECTION_KEY] = false; } }