Do not use application/graphql as default MIME type
As seen in spring-projects/spring-graphql#375, Spring Boot should also use "application/json" as the default MIME type but remain compatible with "application/graphql+json" still if clients POST content with this type or explicitly accept it. Closes gh-30860
This commit is contained in:
@@ -79,7 +79,7 @@ class HttpGraphQlTesterContextCustomizerIntegrationTests {
|
||||
@Override
|
||||
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
|
||||
response.setStatusCode(HttpStatus.OK);
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_GRAPHQL);
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
|
||||
return response.writeWith(Mono.just(factory.wrap("{\"data\":{}}".getBytes())));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class HttpGraphQlTesterContextCustomizerWithCustomBasePathTests {
|
||||
@Override
|
||||
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
|
||||
response.setStatusCode(HttpStatus.OK);
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_GRAPHQL);
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
|
||||
return response.writeWith(Mono.just(factory.wrap("{\"data\":{}}".getBytes())));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class HttpGraphQlTesterContextCustomizerWithCustomContextPathTests {
|
||||
@RestController
|
||||
static class TestController {
|
||||
|
||||
@PostMapping(path = "/graphql", produces = MediaType.APPLICATION_GRAPHQL_VALUE)
|
||||
@PostMapping(path = "/graphql", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
String graphql() {
|
||||
return "{}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user