Fixes issue of creating a new HttpClient on every request.
Description
As noted in https://github.com/openfga/java-sdk/issues/46, we are currently creating a new HttpClient on every request. This change fixes that by building the client when the ApiClient is instantiated, and if the HttpClient.Builder is updated.
Note that this change does not address the retry case, in which we create a new HttpClient with a delayed executor. We should still be able to only create one of those, but as its tied to the Configuration, which is mutable, need to think a bit more about that scenario.
[ ] I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
[x] The correct base branch is being used, if not main
[x] I have added tests to validate that the change in functionality is working as expected
Fixes issue of creating a new
HttpClient
on every request.Description
As noted in https://github.com/openfga/java-sdk/issues/46, we are currently creating a new
HttpClient
on every request. This change fixes that by building the client when theApiClient
is instantiated, and if theHttpClient.Builder
is updated.Note that this change does not address the retry case, in which we create a new
HttpClient
with a delayed executor. We should still be able to only create one of those, but as its tied to theConfiguration
, which is mutable, need to think a bit more about that scenario.References
Review Checklist
main