//readium-shared/org.readium.r2.shared.util.http/DefaultHttpClient/Callback
Callback¶
[androidJvm]\ interface Callback
Callbacks allowing to override some behavior of the DefaultHttpClient.
Functions¶
Name | Summary |
---|---|
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. |
onRecoverRequest | [androidJvm] open suspend fun onRecoverRequest(request: HttpRequest, error: HttpException): HttpTry<HttpRequest> Called when the HTTP client received an error for the given request, to provide an opportunity to the implementer to recover from it. |
onRequestFailed | [androidJvm] open suspend fun onRequestFailed(request: HttpRequest, error: HttpException) Called when the HTTP client received an error for the given request. |
onResponseReceived | [androidJvm] open suspend fun onResponseReceived(request: HttpRequest, response: HttpResponse) Called when the HTTP client received an HTTP response for the given request. |
onStartRequest | [androidJvm] open suspend fun onStartRequest(request: HttpRequest): HttpTry<HttpRequest> Called when the HTTP client will start a new request. |