Skip to content

fix(request): make add operations append existing values#6375

Open
SouthwestAsiaFloat wants to merge 3 commits into
apache:masterfrom
SouthwestAsiaFloat:master
Open

fix(request): make add operations append existing values#6375
SouthwestAsiaFloat wants to merge 3 commits into
apache:masterfrom
SouthwestAsiaFloat:master

Conversation

@SouthwestAsiaFloat

@SouthwestAsiaFloat SouthwestAsiaFloat commented Jun 9, 2026

Copy link
Copy Markdown

Description

This PR fixes the inconsistency between add* and set* operations in the Request Plugin.

Previously, addParameters, addHeaders, and addCookies internally used set() operations, causing existing values to be overwritten and making them behave the same as their corresponding set* operations.

This behavior is inconsistent with the documented semantics in RequestHandle and the implementation of ModifyResponsePlugin, where:

  • add* operations append values.
  • set* operations overwrite values.

Changes

  • Use queryParams.add(...) for addParameters.
  • Use headers.add(...) for addHeaders.
  • Use cookies.add(...) for addCookies.
  • Keep existing setParameters, setHeaders, and setCookies behavior unchanged.
  • Add/update unit tests covering requests that already contain the target key.

Tests

  • ./mvn -pl shenyu-plugin/shenyu-plugin-request test

Checklist

  • I have read the contribution guidelines.
  • I submit test cases that back my changes.
  • My local tests passed.

Fixes #6360

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Request plugin add* operations overwrite existing values like set*

2 participants