Skip to content

Commit

Permalink
updated config, simplified defaults for http client
Browse files Browse the repository at this point in the history
  • Loading branch information
ibalosh committed Dec 19, 2023
1 parent ea0233c commit ae63f8c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/com/postmarkapp/postmark/client/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpEntity;
Expand All @@ -14,8 +13,6 @@
import java.io.IOException;
import java.util.Map;



/**
* Base HTTP client class solely responsible for making
* client requests and returning simple HTTP response.
Expand Down Expand Up @@ -46,6 +43,8 @@ public HttpClient(Map<String,Object> headers, int connectTimeoutSeconds, int rea
this.clientConfigBuilder = RequestConfig
.custom()
.setConnectTimeout(Timeout.ofSeconds(connectTimeoutSeconds))
.setConnectionRequestTimeout(Timeout.ofSeconds(connectTimeoutSeconds))
.setConnectionKeepAlive(Timeout.ofSeconds(connectTimeoutSeconds))
.setResponseTimeout(Timeout.ofSeconds(readTimeoutSeconds));

this.client = buildClient();
Expand Down Expand Up @@ -158,7 +157,6 @@ private CloseableHttpClient buildClient() {
return HttpClientBuilder
.create()
.setDefaultRequestConfig(clientConfigBuilder.build())
.setConnectionManager(new PoolingHttpClientConnectionManager())
.build();
}

Expand Down

0 comments on commit ae63f8c

Please sign in to comment.