mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
Stop using internal variable from okhttp3 (#17458)
This commit is contained in:
@@ -35,9 +35,6 @@ import okhttp3.Response
|
||||
{{#jvm-okhttp3}}
|
||||
import okhttp3.internal.Util.EMPTY_REQUEST
|
||||
{{/jvm-okhttp3}}
|
||||
{{#jvm-okhttp4}}
|
||||
import okhttp3.internal.EMPTY_REQUEST
|
||||
{{/jvm-okhttp4}}
|
||||
import java.io.BufferedWriter
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
@@ -77,6 +74,10 @@ import com.fasterxml.jackson.core.type.TypeReference
|
||||
import com.squareup.moshi.adapter
|
||||
{{/moshi}}
|
||||
|
||||
{{#jvm-okhttp4}}
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}} val EMPTY_REQUEST: RequestBody = ByteArray(0).toRequestBody()
|
||||
{{/jvm-okhttp4}}
|
||||
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) {
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}companion object {
|
||||
protected const val ContentType = "Content-Type"
|
||||
@@ -411,6 +412,7 @@ import com.squareup.moshi.adapter
|
||||
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{{#jvm-okhttp3}}(){{/jvm-okhttp3}},
|
||||
|
||||
Reference in New Issue
Block a user