User Agent

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

  1. val client = HttpClient() {
  2. // Full configuration.
  3. install(UserAgent) {
  4. agent = "ktor"
  5. }
  6. // Shortcut for the browser-like user agent.
  7. BrowserUserAgent()
  8. // Shortcut for the curl-like user agent.
  9. CurlUserAgent()
  10. }