zengxp0605 opened a new issue #2731:
URL: https://github.com/apache/incubator-shenyu/issues/2731
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
The GET request header set `content-type:
application/x-www-form-urlencoded`, RpcParamTransformPlugin will get body from
HttpRequest, but in GET requset the body is empty, the parameters is in url
query part.
The code is in the `RpcParamTransformPlugin.java`
```java
if (MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(mediaType)) {
return formData(exchange, request, chain);
}
...
private Mono<Void> formData(final ServerWebExchange exchange, final
ServerHttpRequest serverHttpRequest, final ShenyuPluginChain chain) {
return Mono.from(serverHttpRequest.getBody()
.flatMap(map -> {
String param = resolveBodyFromRequest(map);
LinkedMultiValueMap linkedMultiValueMap;
try {
linkedMultiValueMap =
BodyParamUtils.buildBodyParams(URLDecoder.decode(param,
StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
return Flux.error(e);
}
exchange.getAttributes().put(Constants.PARAM_TRANSFORM,
HttpParamConverter.toMap(() -> linkedMultiValueMap));
return chain.execute(exchange);
}));
}
```
### Expected Behavior
The GET request header set `content-type:
application/x-www-form-urlencoded`, RpcParamTransformPlugin can get parameters
from url query.
### Steps To Reproduce
_No response_
### Environment
```markdown
ShenYu version(s): 2.4.1
```
### Debug logs
_No response_
### Anything else?
_No response_
--
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]