forked from loafle/openapi-generator-original
Stop using internal variable from okhttp3 (#17458)
This commit is contained in:
@@ -15,7 +15,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
|
||||
@@ -29,6 +28,8 @@ import java.time.OffsetTime
|
||||
import java.util.Locale
|
||||
import com.squareup.moshi.adapter
|
||||
|
||||
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"
|
||||
@@ -219,6 +220,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