Skip to content

Commit

Permalink
fix: aligns API surface parameter types
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Oct 11, 2024
1 parent f8617cc commit 2107738
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

Expand All @@ -47,7 +46,7 @@ private KiotaClientFactory() {}
*/
@Nonnull public static OkHttpClient.Builder create(@Nonnull final RequestOption[] requestOptions) {
Objects.requireNonNull(requestOptions, "parameter requestOptions cannot be null");
return create(createDefaultInterceptors(Arrays.asList(requestOptions)));
return create(createDefaultInterceptors(requestOptions));
}

/**
Expand Down Expand Up @@ -99,7 +98,7 @@ private KiotaClientFactory() {}
* @return an array of interceptors.
*/
@Nonnull public static Interceptor[] createDefaultInterceptors() {
return createDefaultInterceptors(Collections.emptyList());
return createDefaultInterceptors(new RequestOption[0]);
}

/**
Expand All @@ -108,7 +107,7 @@ private KiotaClientFactory() {}
* @return an array of interceptors.
*/
@Nonnull public static Interceptor[] createDefaultInterceptors(
@Nonnull final List<RequestOption> requestOptions) {
@Nonnull final RequestOption[] requestOptions) {
Objects.requireNonNull(requestOptions, "parameter requestOptions cannot be null");

UrlReplaceHandlerOption uriReplacementOption = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ void testDefaultInterceptorsWhenRequestOptionsPassedIn() throws IOException {
UrlReplaceHandlerOption urlReplaceHandlerOption =
new UrlReplaceHandlerOption(new HashMap<>(), false);

List<RequestOption> options = new ArrayList<>();
final ArrayList<RequestOption> options = new ArrayList<>();
options.add(urlReplaceHandlerOption);
options.add(retryHandlerOption);

Interceptor[] interceptors = KiotaClientFactory.createDefaultInterceptors(options);
Interceptor[] interceptors =
KiotaClientFactory.createDefaultInterceptors(options.toArray(new RequestOption[0]));
OkHttpClient client = KiotaClientFactory.create(interceptors).build();
List<Interceptor> clientInterceptors = client.interceptors();
assertNotNull(interceptors);
Expand Down

0 comments on commit 2107738

Please sign in to comment.