Skip to content

Commit 9ff5c34

Browse files
gsmetgeoand
authored andcommitted
Quarkus REST - Be more permissive when adding headers
The JAX-RS API is very loose and allows adding Object and in some cases we actually add a List to the headers and we need to take this into account. While I'm usually not for handling things this way, the API is not enforcing things properly so I think we really need to handle this ourself. Fixes #47507
1 parent a2e30b6 commit 9ff5c34

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/AbstractResponseBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,16 @@ public Response.ResponseBuilder cacheControl(CacheControl cacheControl) {
277277
}
278278

279279
@Override
280+
@SuppressWarnings("unchecked")
280281
public Response.ResponseBuilder header(String name, Object value) {
281282
if (value == null) {
282283
metadata.remove(name);
283284
return this;
284285
}
286+
if (value instanceof List values) {
287+
metadata.addAll(name, values);
288+
return this;
289+
}
285290
metadata.add(name, value);
286291
return this;
287292
}

0 commit comments

Comments
 (0)