OpenFeign / OpenFeign/feign

Observable FeignContext with immutable Headers

Open
#2,438 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feedback provided
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing FeignContext and Request::header, focusing on how Propagator.Setter enriches the headers supplied by the underlying Feign Request. Reproduce the case with headers created through Collections.unmodifiableMap(headers), then verify that trace-header enrichment no longer raises UnsupportedOperationException while retaining the existing header values.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.