auth0 / auth0-java

Java client library for the Auth0 platform
https://auth0.com
MIT License
289 stars 131 forks source link

Avoid unnecessary http client creation #618

Open jlannoy opened 7 months ago

jlannoy commented 7 months ago

Checklist

Describe the problem you'd like to have solved

Similar to the issue #480, the ManagmentAPI builder set the value of the httpClient to an instantiated http client, which could then be overridden by callers.

Describe the ideal solution

Objects.nonNull(httpClient) ? httpClient : DefaultHttpClient.newBuilder().build() should be used in the build() method.

Alternatives and current workarounds

None.

Additional context

No response

jlannoy commented 7 months ago

Btw, if you could think to an other way to keep the base url in private final HttpUrl baseUrl;(inside AuthAPI and ManagementAPI) it would then be possible to exclude OkHttp3 + Okio dependencies when using an other http client.