User Agent

预计阅读时间:1分钟

此功能向请求添加User-Agent标头.

此功能在io.ktor.client.features.UserAgent类中io.ktor.client.features.UserAgent ,不需要其他构件.

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()
}

by  ICOPY.SITE