UserAgent

Estimated reading time: 1 minute

This feature add User-Agent header to requests.

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

Install

val client = HttpClient() {

    // full configuration
    install(UserAgent) {
        agent = "ktor"
    }

    // short version for browser-like user agent
    BrowserUserAgent()

    // short version for curl-like user agent
    CurlUserAgent()
}