-
Notifications
You must be signed in to change notification settings - Fork 529
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
wrong status code when schema parse error #554
Comments
The 400 status code was definitely what the spec required at some point in the past, but I haven't looked lately. Let me see if I can find the relevant bit. |
thanks @benwilson512, but i don't think there is relevant bit in the spec . quote from this issue
related issue: GraphiQL expects 200 status for errors |
I have created a PR to resolve that... but I am not 100% convinced what we should be doing here. I am leaning towards returning 200 OK unless the server blows up, mostly because of good point above about batch mutations. The other thing is that HTTP is just a transport layer, and as such transport layer should be invisible for the applications that use it. GraphQL specification seems to not to mention HTTP status codes at all. But HTTP status code used here has a meaning on a transport layer: "request-response cycle was successful". When we return 400 on wrong requests we are also giving it protocol-layer meaning. Now if we keep doing that, swapping GraphQL transport layers from say HTTP to websocket or something else might not be as easy, becausue our application code relies on status codes from transport layer.. that might not be there at all in case of protocol different than HTTP... |
thanks @hubertlepicki |
Will review the plug PR. Technically this is just a plug issue since Absinthe doesn't know anything about status codes, so closing this for now. |
Environment
Expected behavior
should return a 200 status code with error filed contains parse error infos
Actual behavior
when i query with missing arg, the server return a 400 status code, which cause graphql-client treat this as
Network-Error
instead ofGraphQL-Parse-Error
a 400 status code is returned
Relevant Schema/Middleware Code
The text was updated successfully, but these errors were encountered: