From 5bab1907e2eec17bc9def48388dc6c00d251a2f6 Mon Sep 17 00:00:00 2001 From: Cees Bos Date: Wed, 8 Nov 2023 09:44:11 +0100 Subject: [PATCH] Use parent Call.Factory of OkHttpClient --- CHANGELOG.md | 4 ++++ .../com/microsoft/kiota/http/OkHttpRequestAdapter.java | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4beaee196..af8670de9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Changed + +Changed OkHttpRequestAdapter dependency from OkHttpClient to Call.Factory (parent interface implemented by OkHttpClient). + ## [0.8.0] - 2023-10-31 ### Added diff --git a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java index 222b17e6b..b92a1d4f6 100644 --- a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java +++ b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java @@ -48,7 +48,7 @@ import com.microsoft.kiota.store.BackingStoreFactorySingleton; import okhttp3.MediaType; -import okhttp3.OkHttpClient; +import okhttp3.Call; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.ResponseBody; @@ -67,7 +67,7 @@ public class OkHttpRequestAdapter implements com.microsoft.kiota.RequestAdapter { private final static String contentTypeHeaderKey = "Content-Type"; @Nonnull - private final OkHttpClient client; + private final Call.Factory client; @Nonnull private final AuthenticationProvider authProvider; @Nonnull @@ -119,7 +119,7 @@ public OkHttpRequestAdapter(@Nonnull final AuthenticationProvider authentication * @param client the http client to use for sending requests. */ @SuppressWarnings("LambdaLast") - public OkHttpRequestAdapter(@Nonnull final AuthenticationProvider authenticationProvider, @Nullable final ParseNodeFactory parseNodeFactory, @Nullable final SerializationWriterFactory serializationWriterFactory, @Nullable final OkHttpClient client) { + public OkHttpRequestAdapter(@Nonnull final AuthenticationProvider authenticationProvider, @Nullable final ParseNodeFactory parseNodeFactory, @Nullable final SerializationWriterFactory serializationWriterFactory, @Nullable final Call.Factory client) { this(authenticationProvider, parseNodeFactory, serializationWriterFactory, client, null); } /** @@ -131,7 +131,7 @@ public OkHttpRequestAdapter(@Nonnull final AuthenticationProvider authentication * @param observabilityOptions the observability options to use for sending requests. */ @SuppressWarnings("LambdaLast") - public OkHttpRequestAdapter(@Nonnull final AuthenticationProvider authenticationProvider, @Nullable final ParseNodeFactory parseNodeFactory, @Nullable final SerializationWriterFactory serializationWriterFactory, @Nullable final OkHttpClient client, @Nullable final ObservabilityOptions observabilityOptions) { + public OkHttpRequestAdapter(@Nonnull final AuthenticationProvider authenticationProvider, @Nullable final ParseNodeFactory parseNodeFactory, @Nullable final SerializationWriterFactory serializationWriterFactory, @Nullable final Call.Factory client, @Nullable final ObservabilityOptions observabilityOptions) { this.authProvider = Objects.requireNonNull(authenticationProvider, "parameter authenticationProvider cannot be null"); if(client == null) { this.client = KiotaClientFactory.create().build();