diff --git a/features/graphql/docs.feature b/features/graphql/docs.feature new file mode 100644 index 00000000000..7c54a7343f0 --- /dev/null +++ b/features/graphql/docs.feature @@ -0,0 +1,10 @@ +Feature: Documentation support + In order to play with GraphQL + As a client software developer + I want to reach the GraphQL documentation + + Scenario: Retrieve the OpenAPI documentation + Given I add "Accept" header equal to "text/html" + And I send a "GET" request to "/graphql" + Then the response status code should be 200 + And the header "Content-Type" should be equal to "text/html; charset=utf-8" diff --git a/src/GraphQl/Action/GraphQlPlaygroundAction.php b/src/GraphQl/Action/GraphQlPlaygroundAction.php index ff00e970160..cc03e4a4a06 100644 --- a/src/GraphQl/Action/GraphQlPlaygroundAction.php +++ b/src/GraphQl/Action/GraphQlPlaygroundAction.php @@ -37,7 +37,7 @@ public function __invoke(Request $request): Response 'title' => $this->title, 'graphql_playground_data' => ['entrypoint' => $this->router->generate('api_graphql_entrypoint')], 'assetPackage' => $this->assetPackage, - ])); + ]), 200, ['content-type' => 'text/html']); } throw new BadRequestHttpException('GraphQL Playground is not enabled.'); diff --git a/src/GraphQl/Action/GraphiQlAction.php b/src/GraphQl/Action/GraphiQlAction.php index cd8dc288123..dc6c0119483 100644 --- a/src/GraphQl/Action/GraphiQlAction.php +++ b/src/GraphQl/Action/GraphiQlAction.php @@ -37,7 +37,7 @@ public function __invoke(Request $request): Response 'title' => $this->title, 'graphiql_data' => ['entrypoint' => $this->router->generate('api_graphql_entrypoint')], 'assetPackage' => $this->assetPackage, - ])); + ]), 200, ['content-type' => 'text/html']); } throw new BadRequestHttpException('GraphiQL is not enabled.');