From 97a620dd1dfcf7c8ef4112c1d921ee3a97f4c029 Mon Sep 17 00:00:00 2001 From: Benjie Date: Tue, 6 Sep 2022 16:50:48 +0100 Subject: [PATCH 1/3] Server can choose the media type --- spec/GraphQLOverHTTP.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/GraphQLOverHTTP.md b/spec/GraphQLOverHTTP.md index 434711b5..39aa742a 100644 --- a/spec/GraphQLOverHTTP.md +++ b/spec/GraphQLOverHTTP.md @@ -443,9 +443,9 @@ In alignment with the specification, when a client does not include at least one supported media type in the `Accept` HTTP header, the server MUST either: -1. Disregard the `Accept` header and respond with the default media type of - `application/json`, specifying this in the `Content-Type` header; OR -2. Respond with a `406 Not Acceptable` status code and stop processing the +1. Disregard the `Accept` header and respond with the server's choice of media + type, indicating this in the `Content-Type` header; OR +3. Respond with a `406 Not Acceptable` status code and stop processing the request. A server MUST support any _GraphQL-over-HTTP request_ which accepts the From 37f82a5a8b18a00eb47dfeff3ae00f7a1b26cb90 Mon Sep 17 00:00:00 2001 From: Benjie Date: Tue, 6 Sep 2022 16:54:27 +0100 Subject: [PATCH 2/3] Update GraphQLOverHTTP.md --- spec/GraphQLOverHTTP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/GraphQLOverHTTP.md b/spec/GraphQLOverHTTP.md index 39aa742a..f6bcf5f0 100644 --- a/spec/GraphQLOverHTTP.md +++ b/spec/GraphQLOverHTTP.md @@ -445,7 +445,7 @@ in the `Accept` HTTP header, the server MUST either: 1. Disregard the `Accept` header and respond with the server's choice of media type, indicating this in the `Content-Type` header; OR -3. Respond with a `406 Not Acceptable` status code and stop processing the +2. Respond with a `406 Not Acceptable` status code and stop processing the request. A server MUST support any _GraphQL-over-HTTP request_ which accepts the From a2509bbbb9eeb635c92d3668c4d71385cb8a307b Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Tue, 3 Oct 2023 14:30:57 +0100 Subject: [PATCH 3/3] Update RFC text with RECOMMENDED/NOT RECOMMENDED --- spec/GraphQLOverHTTP.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/spec/GraphQLOverHTTP.md b/spec/GraphQLOverHTTP.md index f6bcf5f0..dac875d7 100644 --- a/spec/GraphQLOverHTTP.md +++ b/spec/GraphQLOverHTTP.md @@ -443,10 +443,15 @@ In alignment with the specification, when a client does not include at least one supported media type in the `Accept` HTTP header, the server MUST either: -1. Disregard the `Accept` header and respond with the server's choice of media - type, indicating this in the `Content-Type` header; OR -2. Respond with a `406 Not Acceptable` status code and stop processing the - request. +1. Respond with a `406 Not Acceptable` status code and stop processing the + request (RECOMMENDED); OR +2. Disregard the `Accept` header and respond with the server's choice of media + type (NOT RECOMMENDED). + +Note: It is unlikely that a client can process a response that does not match +one of the media types it has requested, hence `406 Not Acceptable` being the +recommended response. However, the server authors may know better about the +specific clients consuming their endpoint, thus both approaches are permitted. A server MUST support any _GraphQL-over-HTTP request_ which accepts the `application/json` media type (as indicated by the `Accept` header).