Should BAD_USER_INPUT
raise a 400 error?
#7460
-
According to the docs, a failure to parse/validate a request should raise a 400. This should imply that sending a request with required variables and no input should also raise a 400, because the request as a whole is technically invalid:
However, when upgrading from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Fair question, there's maybe some nuance to the language here. Assuming you're referring to:
Invalid variables actually surface during execution, mostly as an unfortunate detail of apollo-server/packages/server/src/requestPipeline.ts Lines 447 to 468 in d7e9b97 This case is falling awkwardly into the last bullet, and I can sympathize with any confusion on this one:
If that status code is important to you, you can configure it with a plugin. Take a look at the examples in the docs here and let me know if that's helpful. |
Beta Was this translation helpful? Give feedback.
Fair question, there's maybe some nuance to the language here. Assuming you're referring to:
Invalid variables actually surface during execution, mostly as an unfortunate detail of
graphql-js
's variable resolution being baked into execution (described at length here):apollo-server/packages/server/src/requestPipeline.ts
Lines 447 to 468 in d7e9b97