Jan
12/27/2021, 2:29 PMAleksei Tirman [JB]
12/27/2021, 2:36 PMexpectSuccess
property to `false`https://ktor.io/docs/response-validation.html#defaultJan
12/27/2021, 2:41 PMHttpResponseValidator {
handleResponseException {
val clientException = it as? ClientRequestException ?: return@handleResponseException
errorHandler.handle(clientException)
}
}
Aleksei Tirman [JB]
12/27/2021, 2:47 PMJan
12/27/2021, 2:50 PMval http = HttpClient {
config.httpClientConfig(this)
defaultRequest {
header("Authorization", "Bot ${config.token}")
header("User-Agent", "<http://Discord.KM|Discord.KM> (\$<https://github.com/jan-tennert/Discord.KM>, $0.3)")
}
HttpResponseValidator {
handleResponseException {
val clientException = it as? ClientRequestException ?: return@handleResponseException
errorHandler.handle(clientException)
}
}
expectSuccess = false
}
Aleksei Tirman [JB]
12/28/2021, 9:27 AMvalidateResponse
inside HttpResponseValidator
to validate a response.