mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 20:37:08 +00:00
Stop using internal variable from okhttp3 (#17458)
This commit is contained in:
@@ -16,7 +16,6 @@ import okhttp3.MultipartBody
|
||||
import okhttp3.Call
|
||||
import okhttp3.Callback
|
||||
import okhttp3.Response
|
||||
import okhttp3.internal.EMPTY_REQUEST
|
||||
import java.io.BufferedWriter
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
@@ -31,6 +30,8 @@ import java.util.Locale
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.encodeToString
|
||||
|
||||
val EMPTY_REQUEST: RequestBody = ByteArray(0).toRequestBody()
|
||||
|
||||
open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) {
|
||||
companion object {
|
||||
protected const val ContentType = "Content-Type"
|
||||
@@ -224,6 +225,7 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
|
||||
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.US)
|
||||
|
||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||
@Suppress("UNNECESSARY_SAFE_CALL")
|
||||
return when {
|
||||
response.isRedirect -> Redirection(
|
||||
response.code,
|
||||
|
||||
Reference in New Issue
Block a user