ExpectSuccess

预计阅读时间: 1 分钟

This feature checks that the response is OK (code < 300) or throws a BadResponseStatus.

本特性在 io.ktor.client.features.ExpectSuccess 类中定义,无需任何额外构件。

Install

This feature is installed by default.

Prevent installing

You can prevent installing this feature by setting the HttpClient.expectSuccess property to false:

val client = HttpClient(HttpClientEngine) {
    expectSuccess = false
}