upgrade spring-cloud-release from F to G, feign urlencode error
See original GitHub issueupgrade 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:
- Created 5 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
or encode it yourself as
+
as a space, you must use the space character%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.
@kdavisk6 thanks!