-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新增 apache http builder,支持 apache http client #315
base: main
Are you sure you want to change the base?
Conversation
ed47b59
to
b5ea2fa
Compare
如何使用,能否补充个文档,或者在 pr 中说明 |
core/src/main/java/com/wechat/pay/java/core/http/ApacheHttpClientBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/wechat/pay/java/core/http/ApacheHttpClientBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/wechat/pay/java/core/http/ApacheHttpClientBuilder.java
Show resolved
Hide resolved
建议再增加一个实现 |
Quality Gate passedIssues Measures |
怎么提供更高效的迁移支持我们下周再想办法。 |
新增 apache http builder,支持 apache client
使用示例:
// 初始化商户配置
Config config =
new RSAAutoCertificateConfig.Builder()
.merchantId(merchantId)
.privateKeyFromPath(privateKeyPath)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(apiV3Key)
.build();
// 创建 HttpClient
HttpClient httpClient = new ApacheHttpClientBuilder().config(config).build();
// 构造 HttpRequest,以 GET 为例
HttpRequest httpRequest =
new HttpRequest.Builder()
.httpMethod(HttpMethod.GET)
.url(requestPath)
.headers(headers)
.build();
// 发送请求 Response 为自定义的回包的类型
HttpResponse httpResponse =
httpClient.execute(httpRequest, Response.class);