Skip to content

Commit

Permalink
fix(graphql): docs should answer text/html
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Oct 17, 2023
1 parent 51b8183 commit dbd4f64
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions features/graphql/docs.feature
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion src/GraphQl/Action/GraphQlPlaygroundAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQl/Action/GraphiQlAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down

0 comments on commit dbd4f64

Please sign in to comment.