Skip to content

//readium-shared/org.readium.r2.shared.util.http/DefaultHttpClient/Callback/onFollowUnsafeRedirect

onFollowUnsafeRedirect

[androidJvm]\ open suspend fun onFollowUnsafeRedirect(request: HttpRequest, response: HttpResponse, newRequest: HttpRequest): HttpTry<HttpRequest>

Redirections are followed by default when the host and protocols are the same. However, if for example an HTTP server redirects to an HTTPS URI, you will need to confirm explicitly the redirection by implementing this callback as it is potentially unsafe.

It's recommended to confirm the redirection with the user, especially for a POST request.

You can return either: