Skip to content

Commit 5b074dc

Browse files
authored
Merge pull request #1954 from alanpoulain/fix-graphql-response-status-code
[GraphQL] Fix response status code
2 parents d6b01d7 + 0baec87 commit 5b074dc

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

features/graphql/authorization.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Feature: Authorization checking
1515
}
1616
}
1717
"""
18-
Then the response status code should be 400
18+
Then the response status code should be 200
1919
And the response should be in JSON
2020
And the header "Content-Type" should be equal to "application/json"
2121
And the JSON node "errors[0].message" should be equal to "Access Denied."
@@ -35,7 +35,7 @@ Feature: Authorization checking
3535
}
3636
}
3737
"""
38-
Then the response status code should be 400
38+
Then the response status code should be 200
3939
And the response should be in JSON
4040
And the header "Content-Type" should be equal to "application/json"
4141
And the JSON node "errors[0].message" should be equal to "Access Denied."
@@ -51,7 +51,7 @@ Feature: Authorization checking
5151
}
5252
}
5353
"""
54-
Then the response status code should be 400
54+
Then the response status code should be 200
5555
And the response should be in JSON
5656
And the header "Content-Type" should be equal to "application/json"
5757
And the JSON node "errors[0].message" should be equal to "Access Denied."

features/graphql/mutation.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Feature: GraphQL mutation support
252252
}
253253
}
254254
"""
255-
Then the response status code should be 400
255+
Then the response status code should be 200
256256
And the response should be in JSON
257257
And the header "Content-Type" should be equal to "application/json"
258258
And the JSON node "errors[0].message" should be equal to "name: This value should not be blank."

src/GraphQl/Action/EntrypointAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __invoke(Request $request): Response
6767
$executionResult = new ExecutionResult(null, [$e]);
6868
}
6969

70-
return new JsonResponse($executionResult->toArray($this->debug), $executionResult->errors ? Response::HTTP_BAD_REQUEST : Response::HTTP_OK);
70+
return new JsonResponse($executionResult->toArray($this->debug));
7171
}
7272

7373
private function parseRequest(Request $request): array

0 commit comments

Comments
 (0)