Skip to content

Commit

Permalink
Issue #12429 - optimize implementation of HttpFields.asMap
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <[email protected]>
  • Loading branch information
lachlan-roberts committed Oct 30, 2024
1 parent 8ff6828 commit 0487815
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,14 @@ default int size()
static Map<String, List<String>> asMap(HttpFields fields)
{
Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
fields.getFieldNamesCollection().forEach(name -> headers.putIfAbsent(name, fields.getValuesList(name)));
for (HttpField f : fields)
{
if (!headers.containsKey(f.getName()))
{
HttpHeader header = f.getHeader();
headers.put(f.getName(), header == null ? fields.getValuesList(f.getName()) : fields.getValuesList(header));
}
}
return headers;
}

Expand Down

0 comments on commit 0487815

Please sign in to comment.