mini docs

May 2022

I just received a question on why GraphQL always returns HTTP status 200.

The specification defines GraphQL at the application layer, but the status code reflects the status of a transport layer.

To return query statuses you need to add a type to the schema with a field for status.

type Customer {  
  id: Int!  
  name: String!  
type CustomerResult {  
  status: String!  
  message: String  
  node: Customer  
type Query {  
  customer(id: Int!): CustomerResult!