Skip to content

Commit

Permalink
combine headers before adding to connection
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Sep 23, 2024
1 parent 7bf35c7 commit 8a0d2a6
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,16 @@ protected <T> J_N_H_HttpResponse<T> sendImpl(J_N_H_HttpRequest var1, J_N_H_HttpR

HttpRequestImpl request = (HttpRequestImpl) var1;

request.headers.forEach((k, v) -> putHeaders(connection, k, v));
cookieHandler.get(var1.uri(), request.headers).forEach((k, v) -> putHeaders(connection, k, v));
Map<String, List<String>> headers = new HashMap<>();
for (Map.Entry<String, List<String>> header : request.headers.entrySet()) {
headers.computeIfAbsent(header.getKey(), k -> new ArrayList<>()).addAll(header.getValue());
}
for (Map.Entry<String, List<String>> header : cookieHandler.get(var1.uri(), request.headers).entrySet()) {
headers.computeIfAbsent(header.getKey(), k -> new ArrayList<>()).addAll(header.getValue());
}
for (Map.Entry<String, List<String>> header : headers.entrySet()) {
putHeaders(connection, header.getKey(), header.getValue());
}

J_N_H_HttpRequest.BodyPublisher publisher = request.publisher;

Expand Down

0 comments on commit 8a0d2a6

Please sign in to comment.