jsoup icon indicating copy to clipboard operation
jsoup copied to clipboard

Use TreeMap to store headers

Open Isira-Seneviratne opened this issue 1 year ago • 1 comments

Use the TreeMap class to store the headers, as it allows keys to be checked case-insensitively.

Isira-Seneviratne avatar Jan 30 '24 03:01 Isira-Seneviratne

Hmm - this looks neater, but it changes the semantics. The LinkedHashMap implementation keeps the headers in the order they are added. But the TreeMap will sort them alphabetically. The LinkedHashMap is a deliberate choice to maintain the original order.

I thought we had tests to verify the order was maintained but I guess not. That would be good to add...

jhy avatar Jul 29 '24 05:07 jhy

@Isira-Seneviratne I think we need to close this one, as mentioned, using a TreeMap will lose the insert order of the headers. I want to keep the insertion order so that it reflects the order that they were sent by the server.

LMK if you have another idea for the case insensitive scan.

jhy avatar Dec 14 '24 03:12 jhy