7
7
import static com .wechat .pay .java .core .http .Constant .USER_AGENT ;
8
8
import static com .wechat .pay .java .core .http .Constant .USER_AGENT_FORMAT ;
9
9
import static com .wechat .pay .java .core .http .Constant .VERSION ;
10
+ import static com .wechat .pay .java .core .http .Constant .WECHAT_PAY_SERIAL ;
10
11
import static java .net .HttpURLConnection .HTTP_MULT_CHOICE ;
11
12
import static java .net .HttpURLConnection .HTTP_OK ;
12
13
import static java .util .Objects .requireNonNull ;
@@ -39,6 +40,7 @@ public <T> HttpResponse<T> execute(HttpRequest httpRequest, Class<T> responseCla
39
40
.headers (httpRequest .getHeaders ())
40
41
.addHeader (AUTHORIZATION , getAuthorization (httpRequest ))
41
42
.addHeader (USER_AGENT , getUserAgent ())
43
+ .addHeader (WECHAT_PAY_SERIAL , getWechatPaySerial ())
42
44
.body (httpRequest .getBody ())
43
45
.build ();
44
46
OriginalResponse originalResponse = innerExecute (innerRequest );
@@ -57,6 +59,7 @@ public InputStream download(String url) {
57
59
.addHeader (AUTHORIZATION , getAuthorization (originRequest ))
58
60
.addHeader (ACCEPT , "*/*" )
59
61
.addHeader (USER_AGENT , getUserAgent ())
62
+ .addHeader (WECHAT_PAY_SERIAL , getWechatPaySerial ())
60
63
.build ();
61
64
return innerDownload (httpRequest );
62
65
}
@@ -130,6 +133,10 @@ private String getUserAgent() {
130
133
getHttpClientInfo ());
131
134
}
132
135
136
+ private String getWechatPaySerial () {
137
+ return this .validator .getSerialNumber ();
138
+ }
139
+
133
140
/**
134
141
* 获取http客户端信息,用于User-Agent。 格式:客户端名称/版本 示例:okhttp3/4.9.3
135
142
*
0 commit comments