Skip to content

Commit d201212

Browse files
committed
Support for reloading httpClient connectTimeout Configuration
1 parent 63a9e0c commit d201212

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/NettyRoutingFilter.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2020 the original author or authors.
2+
* Copyright 2013-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -254,7 +254,8 @@ protected Mono<HttpClient> getHttpClientMono(Route route, ServerWebExchange exch
254254
* @return the configured HttpClient.
255255
*/
256256
protected HttpClient getHttpClient(Route route, ServerWebExchange exchange) {
257-
Object connectTimeoutAttr = route.getMetadata().get(CONNECT_TIMEOUT_ATTR);
257+
Object connectTimeoutAttr = route.getMetadata().get(CONNECT_TIMEOUT_ATTR) != null
258+
? route.getMetadata().get(CONNECT_TIMEOUT_ATTR) : properties.getConnectTimeout();
258259
if (connectTimeoutAttr != null) {
259260
Integer connectTimeout = getInteger(connectTimeoutAttr);
260261
return this.httpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectTimeout);

0 commit comments

Comments
 (0)