微信请求 header 添加 Wechatpay-Serial

This commit is contained in:
gong
2026-01-09 17:06:11 +08:00
parent 8cbf20e751
commit 0513cd5e65

View File

@@ -54,12 +54,14 @@ public class WechatReqUtils {
HttpRequest request = switch (method) { HttpRequest request = switch (method) {
case "POST" -> HttpUtil.createPost(configDto.getDomain() + url) case "POST" -> HttpUtil.createPost(configDto.getDomain() + url)
.header("Authorization", authorization) .header("Authorization", authorization)
.header("Wechatpay-Serial", configDto.getPublicKeyId())
.charset(StandardCharsets.UTF_8) .charset(StandardCharsets.UTF_8)
.contentType("application/json") .contentType("application/json")
.body(body ); .body(body );
case "GET" -> HttpUtil.createGet(configDto.getDomain() + url) case "GET" -> HttpUtil.createGet(configDto.getDomain() + url)
.header("Authorization", authorization) .header("Authorization", authorization)
.header("Wechatpay-Serial", configDto.getPublicKeyId())
.charset(StandardCharsets.UTF_8) .charset(StandardCharsets.UTF_8)
.contentType("application/json"); .contentType("application/json");
default -> throw new CzgException("不支持的请求方法"); default -> throw new CzgException("不支持的请求方法");