forked from loafle/openapi-generator-original
Co-authored-by: Grigory Tihonov <grigory.tihonov@lamoda.ru>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
package org.openapitools.client.apis
|
||||
|
||||
import java.io.IOException
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
@@ -39,7 +40,7 @@ import org.openapitools.client.infrastructure.ResponseType
|
||||
import org.openapitools.client.infrastructure.Success
|
||||
import org.openapitools.client.infrastructure.toMultiValue
|
||||
|
||||
class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
|
||||
class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.time.OffsetTime
|
||||
import java.util.Locale
|
||||
import com.squareup.moshi.adapter
|
||||
|
||||
open class ApiClient(val baseUrl: String) {
|
||||
open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) {
|
||||
companion object {
|
||||
protected const val ContentType = "Content-Type"
|
||||
protected const val Accept = "Accept"
|
||||
@@ -47,7 +47,7 @@ open class ApiClient(val baseUrl: String) {
|
||||
const val baseUrlKey = "org.openapitools.client.baseUrl"
|
||||
|
||||
@JvmStatic
|
||||
val client: OkHttpClient by lazy {
|
||||
val defaultClient: OkHttpClient by lazy {
|
||||
builder.build()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user