Skip to content

Commit a099a98

Browse files
committed
feat: allow overriding default & no cookies request configs
1 parent 845f8d5 commit a099a98

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

main/src/main/java/com/sedmelluq/discord/lavaplayer/tools/io/HttpClientTools.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,28 @@
3737
public class HttpClientTools {
3838
private static final Logger log = LoggerFactory.getLogger(HttpClientTools.class);
3939

40-
public static final RequestConfig DEFAULT_REQUEST_CONFIG = RequestConfig.custom()
40+
public static RequestConfig DEFAULT_REQUEST_CONFIG = RequestConfig.custom()
4141
.setConnectTimeout(3000)
4242
.setConnectionRequestTimeout(3000)
4343
.setSocketTimeout(3000)
4444
.setCookieSpec(CookieSpecs.STANDARD)
4545
.build();
4646

47-
private static final RequestConfig NO_COOKIES_REQUEST_CONFIG = RequestConfig.custom()
47+
private static RequestConfig NO_COOKIES_REQUEST_CONFIG = RequestConfig.custom()
4848
.setConnectTimeout(3000)
4949
.setConnectionRequestTimeout(3000)
5050
.setSocketTimeout(3000)
5151
.setCookieSpec(CookieSpecs.IGNORE_COOKIES)
5252
.build();
5353

54+
public static void setDefaultRequestConfig(RequestConfig requestConfig) {
55+
DEFAULT_REQUEST_CONFIG = requestConfig;
56+
}
57+
58+
public static void setNoCookiesRequestConfig(RequestConfig requestConfig) {
59+
NO_COOKIES_REQUEST_CONFIG = requestConfig;
60+
}
61+
5462
/**
5563
* @return An HttpClientBuilder which uses the same cookie store for all clients
5664
*/

0 commit comments

Comments
 (0)