Skip to content

Commit

Permalink
Guard against null headers when converting a provided Response
Browse files Browse the repository at this point in the history
Relates to: quarkusio#35730
  • Loading branch information
geoand committed Sep 5, 2023
1 parent 59536b2 commit 55092ca
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jboss.resteasy.reactive.server.handlers;

import jakarta.ws.rs.core.MultivaluedMap;
import java.io.ByteArrayInputStream;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -195,10 +196,13 @@ private ResponseBuilderImpl fromResponse(Response response) {
if (response.hasEntity()) {
b.entity(response.getEntity());
}
for (String headerName : response.getHeaders().keySet()) {
List<Object> headerValues = response.getHeaders().get(headerName);
for (Object headerValue : headerValues) {
b.header(headerName, headerValue);
var headers = response.getHeaders();
if (headers != null) {
for (String headerName : headers.keySet()) {
List<Object> headerValues = headers.get(headerName);
for (Object headerValue : headerValues) {
b.header(headerName, headerValue);
}
}
}
return (ResponseBuilderImpl) b;
Expand Down

0 comments on commit 55092ca

Please sign in to comment.