mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-18 07:53:41 +08:00
refactor: 在请求头Content-Type中声明字符集UTF-8,避免中文乱码
This commit is contained in:
@@ -226,7 +226,8 @@ public class WechatPayClient {
|
|||||||
httpHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
httpHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||||
// for upload
|
// for upload
|
||||||
if (Objects.isNull(httpHeaders.getContentType())) {
|
if (Objects.isNull(httpHeaders.getContentType())) {
|
||||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
// 避免出现因为中文导致的 HttpRetryException
|
||||||
|
httpHeaders.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
||||||
}
|
}
|
||||||
httpHeaders.add("Authorization", authorization);
|
httpHeaders.add("Authorization", authorization);
|
||||||
httpHeaders.add("User-Agent", "X-Pay-Service");
|
httpHeaders.add("User-Agent", "X-Pay-Service");
|
||||||
|
|||||||
Reference in New Issue
Block a user