@@ -485,32 +485,22 @@ execution regardless of validation errors.
485485
486486## Status Codes
487487
488- In case of errors that completely prevent the generation of a well-formed
489- _ GraphQL response_ , the server SHOULD respond with the appropriate status code
490- depending on the concrete error condition.
491-
492- Otherwise, the status code to use depends on the media type with which the
493- GraphQL response will be served.
494-
495- For legacy ` application/json ` responses, see
496- [ Appendix A] ( #sec-Appendix-application-json-responses ) .
497-
498- ### application/graphql-response+json
499-
500- This section only applies when the response body uses the
501- ` application/graphql-response+json ` media type.
502-
503- Clients should process the response as a well-formed _ GraphQL response_
504- independent of the HTTP status code.
488+ Clients should process a response using the ` application/graphql-response+json `
489+ media type as a well-formed _ GraphQL response_ independent of the HTTP status
490+ code.
505491
506492Note: With ` application/graphql-response+json ` , clients know the response is
507493well formed and should determine the detailed status of the response from the
508494response body alone, allowing server authors to adopt more appropriate status
509- codes without impacting behavior of existing clients. Intermediary servers may
510- use the status code to determine the status of the _ GraphQL response_ without
511- needing to process the response body; this is useful in request logs, developer
512- tooling, anomaly and intrusion detection, metrics and observability, API
513- gateways, and more.
495+ codes without impacting behavior of existing clients. Intermediary servers and
496+ services may use the status code to determine the status of the _ GraphQL
497+ response_ without needing to process the response body; this is useful in
498+ request logs, developer tooling, anomaly and intrusion detection, metrics and
499+ observability, API gateways, and more.
500+
501+ In case of errors that completely prevent the generation of a well-formed
502+ _ GraphQL response_ , the server SHOULD respond with the appropriate HTTP ` 4xx ` or
503+ ` 5xx ` status code depending on the concrete error condition.
514504
515505If the _ GraphQL response_ contains the {data} entry and it is not {null}, then
516506the server MUST reply with a ` 2xx ` status code.
@@ -529,7 +519,7 @@ well as encountered errors. Errors that happen during execution of the GraphQL
529519operation typically become part of the result, as long as the server is still
530520able to produce a well-formed _ GraphQL response_ . For details of why status code
531521` 294 ` is recommended, see [ Partial success] ( #sec-Partial-success ) . Using ` 4xx `
532- and ` 5xx ` status codes in this situation is not appropriate - since no _ GraphQL
522+ and ` 5xx ` status codes in this situation is not appropriate: since no _ GraphQL
533523request error_ has occurred it is seen as a "partial response" or "partial
534524success".
535525
@@ -543,8 +533,9 @@ reply with an appropriate `4xx` or `5xx` status code:
543533 - If an unsupported HTTP method is used, status code ` 405 ` is RECOMMENDED.
544534 - If the ` Content-Type ` of the request is not supported, status code ` 415 ` is
545535 RECOMMENDED.
546- - If none of the media types in the ` Accept ` header are supported, status code
547- ` 406 ` is RECOMMENDED.
536+ - If none of the media types in the ` Accept ` header are supported and the
537+ ` Accept ` header does not include ` application/json ` then status code ` 406 `
538+ is RECOMMENDED.
548539 - If the client did not produce a request within the time that the server was
549540 prepared to wait, status code ` 408 ` is RECOMMENDED.
550541 - If the size of the URI was too large, status code ` 414 ` is RECOMMENDED (and
@@ -567,10 +558,10 @@ reply with an appropriate `4xx` or `5xx` status code:
567558 definitions, status code ` 422 ` is RECOMMENDED.
568559 - If the client is not permitted to issue the GraphQL request then the server
569560 SHOULD reply with ` 401 ` , ` 403 ` or similar appropriate status code.
570- - If the server is a short and stout ceramic vessel, status code ` 418 ` is
571- RECOMMENDED.
561+ - If the server cannot process the request due to being a short and stout
562+ ceramic vessel, status code ` 418 ` is RECOMMENDED.
572563- When the server is the reason for failure, the appropriate ` 5xx ` status code
573- should be used; for example, if the server is not able to execute requests at
564+ should be used. For example, if the server is not able to execute requests at
574565 this time due to maintenance or load-shedding then status code ` 503 ` is
575566 RECOMMENDED.
576567
@@ -580,9 +571,8 @@ _GraphQL response_ does not include the {data} entry is one in which the
580571
581572#### Examples
582573
583- The following examples provide guidance on how to deal with specific error cases
584- when using the ` application/graphql-response+json ` media type to encode the
585- response body:
574+ The following examples provide guidance on how to deal with specific error
575+ cases:
586576
587577##### JSON parsing failure
588578
@@ -750,5 +740,3 @@ conflicts with future versions of this specification as ongoing development aims
750740to standardize and ensure the security and interoperability of GraphQL over HTTP
751741whilst accounting for its growing feature set. For this reason, it is
752742recommended to adhere to the officially recognized formats outlined here.
753-
754- # [ Appendix: application/json] ( Appendix%20A%20--%20application-json.md )
0 commit comments