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

Want to have different status code for different errors or may have define it in lighthouse.php config file #1694

Closed
kajal98 opened this issue Jan 25, 2021 · 1 comment
Labels
discussion Requires input from multiple people

Comments

@kajal98
Copy link

kajal98 commented Jan 25, 2021

Describe the bug

I have a Mutation register and when I will have a unique error for the email field I want a 422 status code for it but it always returns 200

I have already seen #279

Expected behavior/Solution

It should return 422

Output/Logs

image

Lighthouse Version

5.0

@spawnia
Copy link
Collaborator

spawnia commented Jan 25, 2021

There is consensus among the GraphQL over HTTP working group that completely failed requests should have an status code for the error condition: https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#status-codes

However, I think that in this instance Lighthouse is right in returning a 200 anyways. It would be reasonable to send more then one operations and have one of them fail validation and the other pass completely, which according to the spec MUST result in a 200. Also, they might fail due to unrelated reasons, e.g. authorization. Which would be the correct status code then?

Only failures that completely prevent the execution of any operations at all should be non-200.

@spawnia spawnia closed this as completed Jan 25, 2021
@spawnia spawnia added the discussion Requires input from multiple people label Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Requires input from multiple people
Projects
None yet
Development

No branches or pull requests

2 participants