Skip to content

Commit ad817d8

Browse files
authored
Server can choose the media type on Accept fail (#227)
1 parent 43e6d14 commit ad817d8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

spec/GraphQLOverHTTP.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,15 @@ In alignment with the
443443
specification, when a client does not include at least one supported media type
444444
in the `Accept` HTTP header, the server MUST either:
445445

446-
1. Disregard the `Accept` header and respond with the default media type of
447-
`application/json`, specifying this in the `Content-Type` header; OR
448-
2. Respond with a `406 Not Acceptable` status code and stop processing the
449-
request.
446+
1. Respond with a `406 Not Acceptable` status code and stop processing the
447+
request (RECOMMENDED); OR
448+
2. Disregard the `Accept` header and respond with the server's choice of media
449+
type (NOT RECOMMENDED).
450+
451+
Note: It is unlikely that a client can process a response that does not match
452+
one of the media types it has requested, hence `406 Not Acceptable` being the
453+
recommended response. However, the server authors may know better about the
454+
specific clients consuming their endpoint, thus both approaches are permitted.
450455

451456
A server MUST support any _GraphQL-over-HTTP request_ which accepts the
452457
`application/json` media type (as indicated by the `Accept` header).

0 commit comments

Comments
 (0)