Skip to content

Commit

Permalink
Merge pull request #805 from cbos/pr_okhttpclient_to_callfactory
Browse files Browse the repository at this point in the history
Use parent Call.Factory of OkHttpClient
  • Loading branch information
baywet authored Nov 8, 2023
2 parents 2021aa0 + 5bab190 commit 0df6148
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
}
/**
Expand All @@ -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();
Expand Down

0 comments on commit 0df6148

Please sign in to comment.