The base class used for a number of the URL connection classes does not implement the getHeaderFields() method resulting in an empty map always being returned. This results in inconsistent behaviour with getHeaderField("some-header") returning non-null results for valid headers such as "content-length" at the same time as the getHeaderFields() method is reporting that there no headers associated with the URL.
A straightforward implementation that copies headers from the MessageHeader properties object in to a new TreeMap(String.CASE_INSENSITIVE_ORDER) is possible.
A straightforward implementation that copies headers from the MessageHeader properties object in to a new TreeMap(String.CASE_INSENSITIVE_ORDER) is possible.
- duplicates
-
JDK-8241389 URLConnection::getHeaderFields returns result inconsistent with getHeaderField/Key for FileURLConnection, FtpURLConnection
-
- Closed
-