forked from loafle/openapi-generator-original
[Kotlin] Allow other content-types when only interested in status-code / Unit (#19801)
* Allow Unit response * Updating samples * Improve comment for Unit shortcut
This commit is contained in:
parent
9a0fc5900f
commit
7d1e9997d0
@ -167,8 +167,11 @@ import com.squareup.moshi.adapter
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -124,8 +124,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -124,8 +124,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -126,8 +126,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -127,8 +127,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ internal open class ApiClient(val baseUrl: String, val client: Call.Factory = de
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
@ -125,8 +125,11 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
|
|||||||
val body = response.body
|
val body = response.body
|
||||||
if(body == null) {
|
if(body == null) {
|
||||||
return null
|
return null
|
||||||
}
|
} else if (T::class.java == Unit::class.java) {
|
||||||
if (T::class.java == File::class.java) {
|
// No need to parse the body when we're not interested in the body
|
||||||
|
// Useful when API is returning other Content-Type
|
||||||
|
return null
|
||||||
|
} else if (T::class.java == File::class.java) {
|
||||||
// return tempFile
|
// return tempFile
|
||||||
val contentDisposition = response.header("Content-Disposition")
|
val contentDisposition = response.header("Content-Disposition")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user