Callback

interface Callback

Callbacks allowing to override some behavior of the DefaultHttpClient.

Functions

Link copied to clipboard
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.

Link copied to clipboard
open suspend fun onRecoverRequest(request: HttpRequest, error: HttpError): 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.

Link copied to clipboard
open suspend fun onRequestFailed(request: HttpRequest, error: HttpError)

Called when the HTTP client received an error for the given request.

Link copied to clipboard
open suspend fun onResponseReceived(request: HttpRequest, response: HttpResponse)

Called when the HTTP client received an HTTP response for the given request.

Link copied to clipboard
open suspend fun onStartRequest(request: HttpRequest): HttpTry<HttpRequest>

Called when the HTTP client will start a new request.