forked from loafle/openapi-generator-original
[kotlin][client] only use authentication tokens when they are not null (#4238)
* [kotlin-client] only use authentication tokens when they are not null * [kotlin-client] only use authentication tokens when they are not null
This commit is contained in:
committed by
William Cheng
parent
fbf3d593df
commit
620aa4fd5e
@@ -98,7 +98,10 @@ internal class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun findPetsByStatus(status: kotlin.Array<kotlin.String>) : kotlin.Array<Pet> {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf("status" to toMultiValue(status.toList(), "csv"))
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("status", toMultiValue(status.toList(), "csv"))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
@@ -129,7 +132,10 @@ internal class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun findPetsByTags(tags: kotlin.Array<kotlin.String>) : kotlin.Array<Pet> {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf("tags" to toMultiValue(tags.toList(), "csv"))
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("tags", toMultiValue(tags.toList(), "csv"))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
|
||||
@@ -188,7 +188,11 @@ internal class UserApi(basePath: kotlin.String = "http://petstore.swagger.io/v2"
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
|
||||
val localVariableBody: kotlin.Any? = null
|
||||
val localVariableQuery: MultiValueMap = mapOf("username" to listOf("$username"), "password" to listOf("$password"))
|
||||
val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
|
||||
.apply {
|
||||
put("username", listOf(username.toString()))
|
||||
put("password", listOf(password.toString()))
|
||||
}
|
||||
val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
|
||||
val localVariableConfig = RequestConfig(
|
||||
RequestMethod.GET,
|
||||
|
||||
@@ -83,7 +83,9 @@ internal open class ApiClient(val baseUrl: String) {
|
||||
}
|
||||
}
|
||||
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
|
||||
requestConfig.headers[Authorization] = "Bearer " + accessToken
|
||||
accessToken?.let { accessToken ->
|
||||
requestConfig.headers[Authorization] = "Bearer " + accessToken
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user