Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend HttpServerResponseMutator with replace and set if absent variants #11048

Open
ddark008 opened this issue Apr 7, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@ddark008
Copy link

ddark008 commented Apr 7, 2024

Is your feature request related to a problem? Please describe.

Current HttpServerResponseMutator provides only appending header values. In some circumstances, this can lead to duplicate header values. For example, the instrumentation of the spring-cloud-gateway proxy adds additional headers to all packets that are passed through, in addition to existing headers.

Describe the solution you'd like

Extend HttpServerResponseMutator with new methods:

  • replace existing headers
  • set header if absent

Describe alternatives you've considered

No response

Additional context

I can provide some PR to support these features

@ddark008 ddark008 added enhancement New feature or request needs triage New issue that requires triage labels Apr 7, 2024
@steverao
Copy link
Contributor

steverao commented Apr 8, 2024

It looks good! @open-telemetry/java-instrumentation-approvers WDYT?

@steverao steverao removed the needs triage New issue that requires triage label Apr 8, 2024
@laurit
Copy link
Contributor

laurit commented Apr 18, 2024

I think this sounds reasonable. It will require some thought to determine which methods to add. For example if one wishes to modify the value for a header that can contain a comma separated list of values like https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers it would be handy to have access to the original value so instead of overwriting one could append to the existing value. Things are further complicated by the possibility of having the same header set multiple times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants