User Agent

Estimated reading time: 1 minute

This feature adds a 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"
    }

    // Shortcut for the browser-like user agent.
    BrowserUserAgent()

    // Shortcut for the curl-like user agent.
    CurlUserAgent()
}