forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 7.0.x
This commit is contained in:
@@ -40,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, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath) {
|
||||
class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
val defaultBasePath: String by lazy {
|
||||
@@ -223,7 +223,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
|
||||
|
||||
return RequestConfig(
|
||||
method = RequestMethod.POST,
|
||||
path = "/test".replace("{"+"pi0"+"}", "$pi0").replace("{"+"pi1"+"}", "$pi1").replace("{"+"pn0"+"}", "$pn0").replace("{"+"pn1"+"}", "$pn1"),
|
||||
path = "/test".replace("{"+"pi0"+"}", pi0.toString()).replace("{"+"pi1"+"}", pi1.toString()).replace("{"+"pn0"+"}", pn0.toString()).replace("{"+"pn1"+"}", pn1.toString()),
|
||||
query = localVariableQuery,
|
||||
headers = localVariableHeaders,
|
||||
body = localVariableBody
|
||||
|
||||
@@ -118,12 +118,16 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
|
||||
return null
|
||||
}
|
||||
if (T::class.java == File::class.java) {
|
||||
// return tempfile
|
||||
// return tempFile
|
||||
// Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options
|
||||
val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile()
|
||||
f.deleteOnExit()
|
||||
body.byteStream().use { java.nio.file.Files.copy(it, f.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING) }
|
||||
return f as T
|
||||
val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile()
|
||||
tempFile.deleteOnExit()
|
||||
body.byteStream().use { inputStream ->
|
||||
tempFile.outputStream().use { tempFileOutputStream ->
|
||||
inputStream.copyTo(tempFileOutputStream)
|
||||
}
|
||||
}
|
||||
return tempFile as T
|
||||
}
|
||||
val bodyContent = body.string()
|
||||
if (bodyContent.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user