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

Fix UnsupportedOperationException for duplicate keys in AddRequestHeader with ModifyRequestBody #3672

Open
wants to merge 1 commit into
base: 4.1.x
Choose a base branch
from

Conversation

qnnn
Copy link
Contributor

@qnnn qnnn commented Jan 20, 2025

Hi @spencergibb,

I recently discovered an issue when using ModifyRequestBodyGatewayFilterFactory and AddRequestHeaderGatewayFilterFactory together. If ModifyRequestBody is executed first, the header value will be a List of type unmodifiable. If AddRequestHeader then tries to add a key that already exists, it will throw an UnsupportedOperationException.

I tried modifying putAll to addAll in ModifyRequestBodyGatewayFilterFactory, and this is likely to resolve the issue.

@spencergibb
Copy link
Member

What versions are you using?

@qnnn
Copy link
Contributor Author

qnnn commented Jan 20, 2025

What versions are you using?

4.1.5. In the new version, it's unclear whether this issue exists if StrictServerWebExchangeFirewall is not introduced (I haven't verified it yet).

@spencergibb
Copy link
Member

The latest versions of spring boot have the fixes for the underlying read only headers problem. What version of boot are you using?

@qnnn
Copy link
Contributor Author

qnnn commented Jan 20, 2025

The latest versions of spring boot have the fixes for the underlying read only headers problem. What version of boot are you using?

spring boot 3.2.12, springframework 6.1.15.

@spencergibb I noticed it in gh-33666,, and it happens to not be fixed in the 6.1.x version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants