Skip to content

Retain form values that also appear in query parameters - #4351

Open
wozhenbang2004 wants to merge 2 commits into
spring-cloud:mainfrom
wozhenbang2004:fix/form-query-overlap
Open

wozhenbang2004 wants to merge 2 commits into
spring-cloud:mainfrom
wozhenbang2004:fix/form-query-overlap

Conversation

@wozhenbang2004

Copy link
Copy Markdown

When a form parameter has the same name and value as a query parameter, FormFilter removes every matching value while rebuilding the request body. For example, a request with ?tag=shared and form data tag=shared loses the form value.

Consume one matching occurrence for each query value, then retain the remaining values in the form body. The wrapped request continues to expose the original query values through its parameter accessors.

Add regressions for a shared value, repeated query and form values, and mixed overlapping values with body order preserved.

Validation:

./mvnw -s .settings.xml -B -U -Pspring -pl spring-cloud-gateway-server-webmvc -am -Dtest=FormFilterTests -Dsurefire.failIfNoSpecifiedTests=false test
  • Before the fix, at 63a1996: 4 tests, 3 assertion failures, 0 errors.
  • After the fix, at c5fcb4d: 4 tests, 0 failures, 0 errors; Maven build successful.

The post-run git diff --exit-code check failed in both jobs because Maven reformatted the same five pre-existing WebSocket files. Neither file changed by this PR appears in that diff. The validation workflow remains confined to a separate branch in the fork.

Signed-off-by: Kayokoi <113896798+wozhenbang2004@users.noreply.github.com>
Signed-off-by: Kayokoi <113896798+wozhenbang2004@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

2 participants