From b06806f8ef3757706da16845b05b81ce43b57b43 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Wed, 11 Aug 2021 12:40:16 +1000 Subject: [PATCH] Inject modified headers Fixes #19317 --- .../core/ResteasyReactiveRequestContext.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java index f7cd8e532f01e5..0b699f4ace735e 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java @@ -10,6 +10,7 @@ import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Deque; import java.util.LinkedList; import java.util.List; @@ -781,10 +782,22 @@ public void initPathSegments() { @Override public Object getHeader(String name, boolean single) { - if (single) - return serverRequest().getRequestHeader(name); - // empty collections must not be turned to null - return serverRequest().getAllRequestHeaders(name); + if (httpHeaders == null) { + if (single) + return serverRequest().getRequestHeader(name); + // empty collections must not be turned to null + return serverRequest().getAllRequestHeaders(name); + } else { + if (single) + return httpHeaders.getMutableHeaders().getFirst(name); + // empty collections must not be turned to null + List list = httpHeaders.getMutableHeaders().get(name); + if (list == null) { + return Collections.emptyList(); + } else { + return list; + } + } } @Override