From a099a98b55e33c1694b2e2636ecd1c3a33769707 Mon Sep 17 00:00:00 2001 From: topi314 Date: Sat, 7 Dec 2024 17:01:21 +0100 Subject: [PATCH] feat: allow overriding default & no cookies request configs --- .../discord/lavaplayer/tools/io/HttpClientTools.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/com/sedmelluq/discord/lavaplayer/tools/io/HttpClientTools.java b/main/src/main/java/com/sedmelluq/discord/lavaplayer/tools/io/HttpClientTools.java index e4024200..674bae9c 100644 --- a/main/src/main/java/com/sedmelluq/discord/lavaplayer/tools/io/HttpClientTools.java +++ b/main/src/main/java/com/sedmelluq/discord/lavaplayer/tools/io/HttpClientTools.java @@ -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 */