From 4c48dec9dc7dc466aed96fb35fcc263edc619ef5 Mon Sep 17 00:00:00 2001 From: Ivan Bazalii Date: Fri, 3 Feb 2023 15:58:20 +0300 Subject: [PATCH] fix: correct handling of Accept header in graphQL - Fix bug that */* is ignored if it is not listed as the first item in Accept header of graphQL http request --- .../graphql/runtime/SmallRyeGraphQLExecutionHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java index 127e1ed8cc759..6f8787beebb94 100644 --- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java +++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java @@ -223,10 +223,14 @@ private String getRequestAccept(RoutingContext ctx) { if (isValidAcceptRequest(a.rawValue())) { return a.rawValue(); } + + if (a.rawValue().startsWith("*/*")) { + return DEFAULT_RESPONSE_CONTENT_TYPE; + } } // Seems like an unknown accept is passed in String accept = ctx.request().getHeader("Accept"); - if (accept != null && !accept.isEmpty() && !accept.startsWith("*/*")) { + if (accept != null && !accept.isEmpty()) { return accept; } }