Skip to content

Commit 37dd47c

Browse files
committed
Set request timeout in JettyClientHttpRequestFactory
Closes gh-32330
1 parent 57dd2f4 commit 37dd47c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: spring-web/src/main/java/org/springframework/http/client/JettyClientHttpRequestFactory.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -19,6 +19,7 @@
1919
import java.io.IOException;
2020
import java.net.URI;
2121
import java.time.Duration;
22+
import java.util.concurrent.TimeUnit;
2223

2324
import org.eclipse.jetty.client.HttpClient;
2425
import org.eclipse.jetty.client.Request;
@@ -133,6 +134,7 @@ public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IO
133134
}
134135

135136
Request request = this.httpClient.newRequest(uri).method(httpMethod.name());
137+
request.timeout(this.readTimeout, TimeUnit.MILLISECONDS);
136138
return new JettyClientHttpRequest(request, this.readTimeout);
137139
}
138140
}

0 commit comments

Comments
 (0)