@@ -193,10 +193,11 @@ And for a _GraphQL response_:
193
193
For details of the shapes of these JSON payloads, please see
194
194
[ Request] ( #sec-Request ) and [ Response] ( #sec-Response ) .
195
195
196
- If the media type in a ` Content-Type ` or ` Accept ` header includes encoding
197
- information, then the encoding MUST be ` utf-8 ` (e.g.
198
- ` Content-Type: application/graphql-response+json; charset=utf-8 ` ). If encoding
199
- information is not included then ` utf-8 ` MUST be assumed.
196
+ If the media type in a ` Content-Type ` or ` Accept ` header does not include
197
+ encoding information and matches one of the officially recognized GraphQL media
198
+ types, then ` utf-8 ` MUST be assumed (e.g. for header
199
+ ` Content-Type: application/graphql-response+json ` , UTF-8 encoding would be
200
+ assumed).
200
201
201
202
# Request
202
203
@@ -328,7 +329,10 @@ A client MUST indicate the media type of a request body using the `Content-Type`
328
329
header as specified in [ RFC7231] ( https://datatracker.ietf.org/doc/html/rfc7231 ) .
329
330
330
331
A server MUST support POST requests encoded with the ` application/json ` media
331
- type (as indicated by the ` Content-Type ` header).
332
+ type (as indicated by the ` Content-Type ` header) encoded with UTF-8.
333
+
334
+ For POST requests using an officially recognized GraphQL ` Content-Type ` without
335
+ indicating an encoding, the server MUST assume the encoding is ` utf-8 ` .
332
336
333
337
If the client does not supply a ` Content-Type ` header with a POST request, the
334
338
server SHOULD reject the request using the appropriate ` 4xx ` status code.
@@ -339,7 +343,7 @@ they wish when none is supplied, with the understanding that parsing the request
339
343
may fail.
340
344
341
345
A server MAY support POST requests encoded with and/or accepting other media
342
- types.
346
+ types or encodings .
343
347
344
348
If a client does not know the media types the server supports then it SHOULD
345
349
encode the request body in JSON (i.e. with ` Content-Type: application/json ` ).
@@ -415,7 +419,8 @@ The body of the server's response MUST follow the requirements for a
415
419
[ GraphQL response] ( #sec-Response ) , encoded directly in the chosen media type.
416
420
417
421
A server MUST indicate the media type of the response with a ` Content-Type `
418
- header.
422
+ header, and SHOULD indicate the encoding (e.g.
423
+ ` application/graphql-response+json; charset=utf-8 ` ).
419
424
420
425
If an ` Accept ` header is provided, the server MUST respect the given ` Accept `
421
426
header and attempt to encode the response in the highest priority media type
@@ -451,7 +456,7 @@ January 2025.
451
456
452
457
From 1st January 2025 (` 2025-01-01T00:00:00Z ` ), a server MUST support requests
453
458
which accept the ` application/graphql-response+json ` media type (as indicated by
454
- the ` Accept ` header).
459
+ the ` Accept ` header) using the UTF-8 encoding .
455
460
456
461
Before 1st January 2025 (` 2025-01-01T00:00:00Z ` ), if the client does not supply
457
462
an ` Accept ` header, the server SHOULD treat the request as if it had
0 commit comments