ExpectSuccess

Estimated reading time: 1 minute

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

This feature is defined in the class io.ktor.client.features.ExpectSuccess and no additional artifacts are required.

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
}