Redirect

note

Redirect - 图1

This help topic is in development and will be updated in the future.

By default, Ktor HTTP client does follow redirections; this feature allows to follow Location redirects in a way that works with any HTTP engine. Its usage is pretty straightforward, and the only configurable property is the maxJumps (20 by default) that limits how many redirects are tried before giving up (to prevent infinite redirects).

Install

This feature is installed by default.

Prevent installing

  1. val client = HttpClient(HttpClientEngine) {
  2. followRedirects = false
  3. }

note

Redirect - 图2

This feature is included in the core of the HttpClient so it is available always along the client.