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:
@@ -55,12 +55,12 @@ final class WebTestClientTransport implements GraphQlTransport {
|
||||
public Mono<GraphQlResponse> execute(GraphQlRequest request) {
|
||||
|
||||
Map<String, Object> responseMap = this.webTestClient.post()
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.contentType(MediaType.APPLICATION_GRAPHQL)
|
||||
.accept(MediaType.APPLICATION_GRAPHQL)
|
||||
.bodyValue(request.toMap())
|
||||
.exchange()
|
||||
.expectStatus().isOk()
|
||||
.expectHeader().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)
|
||||
.expectHeader().contentTypeCompatibleWith(MediaType.APPLICATION_GRAPHQL)
|
||||
.expectBody(MAP_TYPE)
|
||||
.returnResult()
|
||||
.getResponseBody();
|
||||
|
||||
Reference in New Issue
Block a user