Skip to content

Commit

Permalink
Remove usages of Framework's MediaType.APPLICATION_GRAPHQL
Browse files Browse the repository at this point in the history
Closes gh-1109
  • Loading branch information
bclozel committed Jan 13, 2025
1 parent ff05286 commit 36bfd40
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -48,9 +48,8 @@ final class HttpGraphQlTransport implements GraphQlTransport {
private static final ParameterizedTypeReference<ServerSentEvent<Map<String, Object>>> SSE_TYPE =
new ParameterizedTypeReference<ServerSentEvent<Map<String, Object>>>() { };

// 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;
Expand All @@ -73,11 +72,10 @@ private static MediaType initContentType(WebClient webClient) {


@Override
@SuppressWarnings("removal")
public Mono<GraphQlResponse> 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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<MediaType> SUPPORTED_MEDIA_TYPES = List.of(
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL);
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL);


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<MediaType> SUPPORTED_MEDIA_TYPES = List.of(
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, MediaType.APPLICATION_GRAPHQL);
MediaType.APPLICATION_GRAPHQL_RESPONSE, MediaType.APPLICATION_JSON, APPLICATION_GRAPHQL);


/**
Expand Down

0 comments on commit 36bfd40

Please sign in to comment.