OpenFeign / feign

Feign makes writing java http clients easier
Apache License 2.0
9.37k stars 1.91k forks source link

Observable FeignContext with immutable Headers #2438

Open johnnywiller opened 1 month ago

johnnywiller commented 1 month ago

FeignContext enriches the headers providing Propagator.Setter<C> as of Request::header which modifies the headers in place as opposed to make an immutable copy.

In our case the underlining Feign Request is coming with the headers immutable. The headers were created with Collections.unmodifiableMap(headers) by an underlining library which rewrites the request.

Upon trying to enrich the header with the trace ids we face java.lang.UnsupportedOperationException.

Did you encounter this issue before, have you consider not changing headers in place and instead to a immutable copy of the Map<String, Collection<String>> headers; object?