Open
Description
Context: our server sometimes received HEAD requests from some users to /graphql
and this request leads to 500 status code due to the error GraphQL\Server\Exception\CannotParseJsonBody
in \GraphQL\Server\Helper::parsePsrRequest
.
For now, the bundle adds a route /graphql
with no limiting the request methods that it can handle.
In answer to the similar request in webonyx/graphql-php
- maintainers mentioned, that it is recommended to handle OPTIONS
requests on consumer side (before calling \GraphQL\Server\StandardServer::executePsrRequest
)
Example request log:
method HEAD
protocol HTTP/1.1
response_code 500
response_code_details via_upstream
time 2025-02-07T10:51:09.555612977Z
user_agent Mozilla/5.0 (Linux; U; Android 10; en-us; motorola one Build/JOP24G) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.198 Mobile Safari/537.36
x_envoy_origin_path /graphql
My proposition: return 200 status code with no body when request method is HEAD
in \TheCodingMachine\GraphQLite\Bundle\Controller\GraphQLiteController::handlePsr7Request
.
Refs:
Metadata
Metadata
Assignees
Labels
No labels