question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

upgrade spring-cloud-release from F to G, feign urlencode error

See original GitHub issue

upgrade spring-cloud-release from F to G, feign urlencode error

my app server code is

 @PostMapping(value = "/user/userinfo")
    public BaseResult userInfoSignatureCheck(
            @NotBlank @RequestHeader(WxConstants.HN_APP_ID) String hnAppId,
            @NotBlank @RequestParam(WxConstants.SESSION_KEY) String sessionKey,
            @NotBlank @RequestParam String rawData,
            @NotBlank @RequestParam String signature,
            @NotBlank @RequestParam String encryptedData,
            @NotBlank @RequestParam String iv) {
        try {
            ...
            return BaseResult.success(userInfo);
        } catch (WxErrorException e) {
            log.error("WxErrorException", e);
            return BaseResult.fail(e.getError().getErrorCode(), e.getError().getErrorMsg());
        }
    }

and app client code is

@FeignClient(name = "mini-program-api")
public interface MiniProgramApi {

    @RequestMapping(value = "/mini-program-api/user/userinfo", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    BaseResult<Map<String,Object>> userinfo2(@RequestHeader("hn-app-id") String hnAppId,
                                             @RequestParam("sessionKey") String sessionKey,
                                             @RequestParam("rawData") String rawData,
                                             @RequestParam("signature") String signature,
                                             @RequestParam("encryptedData") String encryptedData,
                                             @RequestParam("iv") String iv);

in spring-cloud-release F version and i request sessionKey param is aaa+bbb i check okhttp3 request log , sessionKey param has been change to aaa%2B%bbb and app server accept sessionKey param is aaa+bbb

in spring-cloud-release G version and i request sessionKey param is aaa+bbb i check okhttp3 request log , sessionKey param has been change to aaa+bbb (no encode) and app server accept sessionKey param is aaa bbb

how can i solve this problem?

thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
kdavisk6commented, Jan 30, 2019

PR #882 is now open. This PR attempts to correct this issue by making sure that each segment of the uri, be it the path or query, are correctly encoded based on the URI and URI Template specifications. With regards to the + symbol, when this appears on the query string, it will be encoded as %2B.

If your intention is to use + as a space, you must use the space character or encode it yourself as %20.

If you are interested in more detail about where all this comes from, I invite you to look at RFC 3986 - Appendix A. It describes what characters are acceptable on each segment of the uri.

0reactions
dragontree101commented, Jan 24, 2019

@kdavisk6 thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to POST form-url-encoded data with Spring Cloud Feign
Use FormEncoder for Feign: https://github.com/OpenFeign/feign-form. And your Feign configuration can look like this:
Read more >
spring-cloud.pdf
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found