[BUG] Spring SDK mixes PathVariable and RequestParam into incorrect URLs
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 9h
- Merged PRs (30d)
- 83
Description
### Current Behavior
`shenyu-sdk-spring` can build an incorrect URL when a client method mixes `@PathVariable` and `@RequestParam` parameters.
Both processors rebuild the URL from the original request template rather than incrementally updating the URL produced by previous processors:
- `PathVariableParameterProcessor` uses `requestTemplate.getUrl() + replaced requestTemplate.getPath()` and calls `shenyuRequest.setUrl(...)`.
- `RequestParamParameterProcessor` starts from `requestTemplate.getPath()` and calls `setUrl(...)` with the query string it builds.
For a method such as:
```java
@GetMapping("/orders/{id}")
Order get(@PathVariable("id") String id, @RequestParam("expand") String expand);
```
if the path variable is processed first and request param second, the request param processor can rebuild the URL from `/orders/{id}` and reintroduce the unresolved path variable. If the order is reversed, the path variable processor can overwrite the query string.
### Expected Behavior
Parameter processors should preserve URL mutations made by previous processors, so path substitution and query parameters compose correctly.
### Impact
Common REST client methods that combine path variables and query parameters can call the wrong URL, either leaving `{id}` unresolved or dropping the query string.
### Code Location
- `shenyu-sdk/shenyu-sdk-spring/src/main/java/org/apache/shenyu/sdk/spring/annotation/PathVariableParameterProcessor.java`
- `shenyu-sdk/shenyu-sdk-spring/src/main/java/org/apache/shenyu/sdk/spring/annotation/RequestParamParameterProcessor.java`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with shenyu-sdk/shenyu-sdk-spring/src/main/java/org/apache/shenyu/sdk/spring/annotation/PathVariableParameterProcessor.java and RequestParamParameterProcessor.java, then trace how each processor receives and updates the request URL. Verify a method combining @PathVariable and @RequestParam, ensuring both substitutions remain in the final URL regardless of processor order. Done means the path variable is resolved and the query string is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100