Skip to content

[REQ] Allow to pass OkHttpClient into ApiClient constructor #5259

@Mugenor

Description

@Mugenor

The problem

Right now ApiClient for language java and library okhttp-gson is generated so that it always create a new OkHttpClient, which is not efficient. And it also recommended to have shared instance of OkHttpClient
In my app I'm go to call API, which is the same for different hosts, so I'm enforced to create ApiClient per host. And it creates OkHttpClient per host, which is I want to avoid.

Also it would be great to have possibility to provide own implementation for authentication.

Suggestion

Make it possible to pass OkHttpClient into constructor of ApiClient. Or maybe just not to instantiate it in ApiClient at all and set it via setter. But it's not very clean.

Make it possible to specify own implementation for authorization.

Also

I saw similar issue for WebClient.
#874

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions