Duansg opened a new pull request, #8006: URL: https://github.com/apache/shenyu/pull/8006
## What When a rule has a `parameter` config, `RequestPlugin` rebuilds the query from decoded values with `UriUtils.encodeQueryParam`, which leaves `+` unescaped. Because the URI is then built with `build(true)`, a literal plus reaches the upstream as a raw `+`, and the upstream decodes it as a space. | Input | Before | After | |---|---|---| | `q=a%2Bb` | `q=a+b` (decoded as `a b`) | `q=a%2Bb` | | `addParameters: c+d` | `added=c+d` (decoded as `c d`) | `added=c%2Bd` | ## How After `encodeQueryParam`, also replace `+` with `%2B` for both keys and values. Valueless parameters (`null` values) are left unchanged. ## Scope - Only requests whose rule has a `parameter` config go through this code. Header-only and cookie-only rules, and path encoding, are unchanged. - The cost is one `String.replace` per component, and it allocates nothing when the string has no `+`. ## Tests - Added `RequestPluginTest#testParameterRulePreservesLiteralPlus`. - `shenyu-plugin-request`: 33 tests pass, and checkstyle passes. Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
