Skip to content

Commit 36bfd40

Browse files
committed
Remove usages of Framework's MediaType.APPLICATION_GRAPHQL
Closes gh-1109
1 parent ff05286 commit 36bfd40

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,9 +48,8 @@ final class HttpGraphQlTransport implements GraphQlTransport {
4848
private static final ParameterizedTypeReference<ServerSentEvent<Map<String, Object>>> SSE_TYPE =
4949
new ParameterizedTypeReference<ServerSentEvent<Map<String, Object>>>() { };
5050

51-
// To be removed in favor of Framework's MediaType.APPLICATION_GRAPHQL_RESPONSE
52-
private static final MediaType APPLICATION_GRAPHQL_RESPONSE =
53-
new MediaType("application", "graphql-response+json");
51+
private static final MediaType APPLICATION_GRAPHQL =
52+
new MediaType("application", "graphql+json");
5453

5554

5655
private final WebClient webClient;
@@ -73,11 +72,10 @@ private static MediaType initContentType(WebClient webClient) {
7372

7473

7574
@Override
76-
@SuppressWarnings("removal")
7775
public Mono<GraphQlResponse> execute(GraphQlRequest request) {
7876
return this.webClient.post()
7977
.contentType(this.contentType)
80-
.accept(MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_GRAPHQL)
78+
.accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL_RESPONSE, APPLICATION_GRAPHQL)
8179
.bodyValue(request.toMap())
8280
.attributes((attributes) -> {
8381
if (request instanceof ClientGraphQlRequest clientRequest) {

spring-graphql/src/main/java/org/springframework/graphql/server/webflux/GraphQlHttpHandler.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 the original author or authors.
2+
* Copyright 2020-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,9 +36,11 @@
3636
*/
3737
public class GraphQlHttpHandler extends AbstractGraphQlHttpHandler {
3838

39-
@SuppressWarnings("removal")
39+
private static final MediaType APPLICATION_GRAPHQL =
40+
new MediaType("application", "graphql+json");
41+
4042
private static final List<MediaType> SUPPORTED_MEDIA_TYPES = List.of(
41-
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL);
43+
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL);
4244

4345

4446
/**

spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandler.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 the original author or authors.
2+
* Copyright 2020-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,9 +41,11 @@
4141
*/
4242
public class GraphQlHttpHandler extends AbstractGraphQlHttpHandler {
4343

44-
@SuppressWarnings("removal")
44+
private static final MediaType APPLICATION_GRAPHQL =
45+
new MediaType("application", "graphql+json");
46+
4547
private static final List<MediaType> SUPPORTED_MEDIA_TYPES = List.of(
46-
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL);
48+
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL);
4749

4850

4951
/**

0 commit comments

Comments
 (0)