You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/01/08 04:22:15 UTC

[GitHub] [incubator-shenyu] zengxp0605 opened a new issue #2731: If the content-type is set "application/x-www-form-urlencoded",and method is "GET", RpcParamTransformPlugin can't get body from HttpRequest.

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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-shenyu] zengxp0605 commented on issue #2731: If the content-type is set "application/x-www-form-urlencoded",and method is "GET", RpcParamTransformPlugin can't get body from HttpRequest.

Posted by GitBox <gi...@apache.org>.
zengxp0605 commented on issue #2731:
URL: https://github.com/apache/incubator-shenyu/issues/2731#issuecomment-1008167158


   @yu199195 I'm sorry. It's my fault.  The header is set content-type "application/x-www-form-urlencoded" both get and post request.


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-shenyu] yu199195 commented on issue #2731: If the content-type is set "application/x-www-form-urlencoded",and method is "GET", RpcParamTransformPlugin can't get body from HttpRequest.

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #2731:
URL: https://github.com/apache/incubator-shenyu/issues/2731#issuecomment-1007883376


   why get  request,set content-type  "application/x-www-form-urlencoded "  ?


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-shenyu] yu199195 commented on issue #2731: If the content-type is set "application/x-www-form-urlencoded",and method is "GET", RpcParamTransformPlugin can't get body from HttpRequest.

Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #2731:
URL: https://github.com/apache/incubator-shenyu/issues/2731#issuecomment-1007883376


   why get  request,set content-type  "application/x-www-form-urlencoded "  ?


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-shenyu] KevinClair closed issue #2731: If the content-type is set "application/x-www-form-urlencoded",and method is "GET", RpcParamTransformPlugin can't get body from HttpRequest.

Posted by GitBox <gi...@apache.org>.
KevinClair closed issue #2731:
URL: https://github.com/apache/incubator-shenyu/issues/2731


   


-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org