OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.44k stars 1.92k forks source link

Feign changes capitalization of header-keys #2328

Open t-merten opened 7 months ago

t-merten commented 7 months ago

I run a wiremock-server which is configured to return a created-response with a location header. The location header is put with an uppercase "L". A simple springboot test checks if the response of the feign client is equal to a ResponseEntity.created(URI). The test fails because the location-key in the header of the feign-response has changed to start with a lowercase "l" during the call Util#caseInsensitiveCopyOf in line 373: result.put(key.toLowerCase(Locale.ROOT), new LinkedList<>());

In my opinion the method Util#caseInsensitiveCopyOf must not change the capitalization of header-keys.

I am using feign-core:13.1 with springboot 3.2.2

youssef3wi commented 7 months ago

The method is transformed into a case-sensitive copy caseSensitiveCopyOf.

kdavisk6 commented 3 weeks ago

Per RFC2616

Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.

I understand that this is not the behavior you would prefer, but it is an acceptable and compliant way of managing headers and changing this behavior would be considered a non-backward compatible breaking change at this time.