You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With OpenApi version 5 a new constructor parameter got added to pass an OkHttpClient to the ApiClient ([#6855]). We thought this is good enough for us, but now we run into some problems with this approach. The parameter should be changed to a Call.Factory instead.
Smaller interface
Only the Call.Factory is used (see retrofitBuilder.client(usedClient), this just sets the Call.Factory)
It is more like it was before version 5 of OpenApi (the exposed adapterBuilder had a callFactory method)
In our use case, we need to replace the underlying http-client during runtime. If we only have to pass the Call.Factory we can easily do this, but if we have to pass the client itself we can't achieve this properly.
Describe the solution you'd like
Change the parameter from OkHttpClient to Call.Factory. Each OkHttpClient is also a Call.Factory, so minimal effort to adopt this change.
Describe alternatives you've considered
With the knowledge that only the Call.Factory interface is used by the ApiClient we could also create our own version of a OkHttpClient and only overwrite the newCall(request) method. But this is based on internal knowledge, which should not be part of the ApiClient API.
I will create a pull request suggestion for this improvement.
The text was updated successfully, but these errors were encountered:
With OpenApi version 5 a new constructor parameter got added to pass an
OkHttpClient
to theApiClient
([#6855]). We thought this is good enough for us, but now we run into some problems with this approach. The parameter should be changed to aCall.Factory
instead.retrofitBuilder.client(usedClient)
, this just sets theCall.Factory
)adapterBuilder
had acallFactory
method)Call.Factory
we can easily do this, but if we have to pass the client itself we can't achieve this properly.Describe the solution you'd like
Change the parameter from
OkHttpClient
toCall.Factory
. EachOkHttpClient
is also aCall.Factory
, so minimal effort to adopt this change.Describe alternatives you've considered
With the knowledge that only the
Call.Factory
interface is used by theApiClient
we could also create our own version of aOkHttpClient
and only overwrite thenewCall(request)
method. But this is based on internal knowledge, which should not be part of theApiClient
API.I will create a pull request suggestion for this improvement.
The text was updated successfully, but these errors were encountered: