Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary http client creation #480

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/com/auth0/client/auth/AuthAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ public static class Builder {
private final String domain;
private final String clientId;
private final String clientSecret;
private Auth0HttpClient httpClient = DefaultHttpClient.newBuilder().build();
private Auth0HttpClient httpClient;

/**
* Create a new Builder
Expand Down Expand Up @@ -969,7 +969,8 @@ public Builder withHttpClient(Auth0HttpClient httpClient) {
* @return the configured {@code AuthAPI} instance.
*/
public AuthAPI build() {
return new AuthAPI(domain, clientId, clientSecret, httpClient);
return new AuthAPI(domain, clientId, clientSecret,
Objects.nonNull(httpClient) ? httpClient : DefaultHttpClient.newBuilder().build());
}
}
}