From 2ad2cb14c7d6512cfc2298deb73164f134d901ed Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:11:22 -0500 Subject: [PATCH] Support per-call timeout in JdkHttpClient (#42932) --- .../java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java index ccddf5598dd2e..6c4312e2fa9c3 100644 --- a/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java +++ b/sdk/core/azure-core-http-jdk-httpclient/src/main/java/com/azure/core/http/jdk/httpclient/JdkHttpClient.java @@ -78,6 +78,9 @@ public Mono send(HttpRequest request) { public Mono send(HttpRequest request, Context context) { boolean eagerlyReadResponse = (boolean) context.getData(HttpUtils.AZURE_EAGERLY_READ_RESPONSE).orElse(false); boolean ignoreResponseBody = (boolean) context.getData(HttpUtils.AZURE_IGNORE_RESPONSE_BODY).orElse(false); + Duration readTimeout = (Duration) context.getData(HttpUtils.AZURE_RESPONSE_TIMEOUT) + .filter(timeoutDuration -> timeoutDuration instanceof Duration) + .orElse(this.readTimeout); Mono jdkRequestMono = Mono.fromCallable(() -> toJdkHttpRequest(request, context));