Skip to content

Commit

Permalink
Inject modified headers
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Aug 11, 2021
1 parent 626b2dc commit b06806f
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> list = httpHeaders.getMutableHeaders().get(name);
if (list == null) {
return Collections.emptyList();
} else {
return list;
}
}
}

@Override
Expand Down

0 comments on commit b06806f

Please sign in to comment.