diff --git a/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java b/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java index c5bc7009..611e34f0 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/client/HttpGraphQlTransport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,9 +48,8 @@ final class HttpGraphQlTransport implements GraphQlTransport { private static final ParameterizedTypeReference>> SSE_TYPE = new ParameterizedTypeReference>>() { }; - // To be removed in favor of Framework's MediaType.APPLICATION_GRAPHQL_RESPONSE - private static final MediaType APPLICATION_GRAPHQL_RESPONSE = - new MediaType("application", "graphql-response+json"); + private static final MediaType APPLICATION_GRAPHQL = + new MediaType("application", "graphql+json"); private final WebClient webClient; @@ -73,11 +72,10 @@ private static MediaType initContentType(WebClient webClient) { @Override - @SuppressWarnings("removal") public Mono execute(GraphQlRequest request) { return this.webClient.post() .contentType(this.contentType) - .accept(MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_GRAPHQL) + .accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL_RESPONSE, APPLICATION_GRAPHQL) .bodyValue(request.toMap()) .attributes((attributes) -> { if (request instanceof ClientGraphQlRequest clientRequest) { diff --git a/spring-graphql/src/main/java/org/springframework/graphql/server/webflux/GraphQlHttpHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/server/webflux/GraphQlHttpHandler.java index a3cc3d33..537f3e0d 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/server/webflux/GraphQlHttpHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/server/webflux/GraphQlHttpHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 the original author or authors. + * Copyright 2020-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,9 +36,11 @@ */ public class GraphQlHttpHandler extends AbstractGraphQlHttpHandler { - @SuppressWarnings("removal") + private static final MediaType APPLICATION_GRAPHQL = + new MediaType("application", "graphql+json"); + private static final List SUPPORTED_MEDIA_TYPES = List.of( - MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL); + MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL); /** diff --git a/spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandler.java index 80a59655..9b35a556 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlHttpHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 the original author or authors. + * Copyright 2020-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,9 +41,11 @@ */ public class GraphQlHttpHandler extends AbstractGraphQlHttpHandler { - @SuppressWarnings("removal") + private static final MediaType APPLICATION_GRAPHQL = + new MediaType("application", "graphql+json"); + private static final List SUPPORTED_MEDIA_TYPES = List.of( - MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL); + MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL); /**