Support application/graphql+json content type

The GraphQL HTTP spec now requires the `"application/graphql+json"`
content type.
This commit applies this type by default in the server and client
implementations. `"application/json"` is still accepted and produced if
requested by clients.

Closes gh-108
This commit is contained in:
Brian Clozel
2022-04-04 13:34:18 +02:00
parent 2cdaf344fc
commit e455ebb3d8
9 changed files with 117 additions and 19 deletions

View File

@@ -56,7 +56,9 @@ request body, as defined in the proposed
https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md[GraphQL over HTTP]
specification. Once the JSON body has been successfully decoded, the HTTP response
status is always 200 (OK), and any errors from GraphQL request execution appear in the
"errors" section of the GraphQL response.
"errors" section of the GraphQL response. The default and preferred choice of media type is
`"application/graphql+json"`, but `"application/json"` is also supported, as described in the
specification.
`GraphQlHttpHandler` can be exposed as an HTTP endpoint by declaring a `RouterFunction`
bean and using the `RouterFunctions` from Spring MVC or WebFlux to create the route. The