mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
[kotlin-client] OkHttp call is now non-blocking (#10303)
* suspend method is now non-blocking * added required imports * generated the samples * suspend method is now non-blocking * added required imports * generated the samples * Cancelling the call when the coroutine is cancelled Only use coroutines when requested Not adding potentially unavailable imports Co-authored-by: Guus Bloemsma <Guus.Bloemsma@Rabobank.nl>
This commit is contained in:
@@ -11,9 +11,13 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.Request
|
||||
import okhttp3.Headers
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.Call
|
||||
import okhttp3.Callback
|
||||
import okhttp3.Response
|
||||
import java.io.BufferedWriter
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.IOException
|
||||
import java.net.URLConnection
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
@@ -178,6 +182,7 @@ open class ApiClient(val baseUrl: String) {
|
||||
}.build()
|
||||
|
||||
val response = client.newCall(request).execute()
|
||||
|
||||
val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault())
|
||||
|
||||
// TODO: handle specific mapping types. e.g. Map<int, Class<?>>
|
||||
|
||||
Reference in New Issue
Block a user