Skip to content

Commit

Permalink
feat: allow overriding default & no cookies request configs
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Dec 7, 2024
1 parent 845f8d5 commit a099a98
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,28 @@
public class HttpClientTools {
private static final Logger log = LoggerFactory.getLogger(HttpClientTools.class);

public static final RequestConfig DEFAULT_REQUEST_CONFIG = RequestConfig.custom()
public static RequestConfig DEFAULT_REQUEST_CONFIG = RequestConfig.custom()
.setConnectTimeout(3000)
.setConnectionRequestTimeout(3000)
.setSocketTimeout(3000)
.setCookieSpec(CookieSpecs.STANDARD)
.build();

private static final RequestConfig NO_COOKIES_REQUEST_CONFIG = RequestConfig.custom()
private static RequestConfig NO_COOKIES_REQUEST_CONFIG = RequestConfig.custom()
.setConnectTimeout(3000)
.setConnectionRequestTimeout(3000)
.setSocketTimeout(3000)
.setCookieSpec(CookieSpecs.IGNORE_COOKIES)
.build();

public static void setDefaultRequestConfig(RequestConfig requestConfig) {
DEFAULT_REQUEST_CONFIG = requestConfig;
}

public static void setNoCookiesRequestConfig(RequestConfig requestConfig) {
NO_COOKIES_REQUEST_CONFIG = requestConfig;
}

/**
* @return An HttpClientBuilder which uses the same cookie store for all clients
*/
Expand Down

0 comments on commit a099a98

Please sign in to comment.