Aias00 opened a new issue, #6489:
URL: https://github.com/apache/shenyu/issues/6489
### 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`
--
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]