Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request a mutation with invalid inputs return status code 200 #804

Closed
no-dap opened this issue Oct 20, 2019 · 2 comments
Closed

Request a mutation with invalid inputs return status code 200 #804

no-dap opened this issue Oct 20, 2019 · 2 comments

Comments

@no-dap
Copy link

no-dap commented Oct 20, 2019

DjangoFormMutation and SerializerMutation return status code 200 even if inputs are invalid.
I found a test code that asserts 200 is correct but isn't it should be 400 rather than 200?
graphene_django.tests.test_views.test_handles_field_errors_caught_by_graphql

@no-dap
Copy link
Author

no-dap commented Oct 20, 2019

Screen Shot 2019-10-19 at 12 20 49 PM

@jkimbo
Copy link
Member

jkimbo commented Oct 20, 2019

@no-dap generally GraphQL HTTP servers don't return anything other than 200 HTTP status codes and any errors are passed back to the client through the "errors" field in the response object. This is mainly because GraphQL supports multiple operations in a single request so it's entirely possible that a request only partially fails and returns both data and errors.

Going to close this issue because I don't think this behaviour should change.

@jkimbo jkimbo closed this as completed Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants