mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-08 06:46:15 +00:00
[Java] Add add constructor to BYO OkHttpClient (#6401)
* [Java] Add add constructor to BYO OkHttpClient * client example * this client changed too
This commit is contained in:
@@ -97,6 +97,23 @@ public class ApiClient {
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
|
||||
/*
|
||||
* Basic constructor with custom OkHttpClient
|
||||
*/
|
||||
public ApiClient(OkHttpClient client) {
|
||||
init();
|
||||
|
||||
httpClient = client;
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
|
||||
authentications.put("http_basic_test", new HttpBasicAuth());
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor for ApiClient to support access token retry on 401/403 configured with client ID
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user