WebRequest

external class WebRequest(source)

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

The listener will be called with listener(details) when a server initiated redirect is about to occur.

Link copied to clipboard
fun onBeforeRequest(listener: (details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) -> Unit) -> Unit?)
fun onBeforeRequest(filter: WebRequestFilter, listener: (details: OnBeforeRequestListenerDetails, callback: (response: CallbackResponse) -> Unit) -> Unit?)

The listener will be called with listener(details, callback) when a request is about to occur.

Link copied to clipboard
fun onBeforeSendHeaders(listener: (details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) -> Unit) -> Unit?)
fun onBeforeSendHeaders(filter: WebRequestFilter, listener: (details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) -> Unit) -> Unit?)

The listener will be called with listener(details, callback) before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any http data is sent.

Link copied to clipboard
fun onCompleted(listener: (details: OnCompletedListenerDetails) -> Unit?)
fun onCompleted(filter: WebRequestFilter, listener: (details: OnCompletedListenerDetails) -> Unit?)

The listener will be called with listener(details) when a request is completed.

Link copied to clipboard

The listener will be called with listener(details) when an error occurs.

Link copied to clipboard
fun onHeadersReceived(listener: (details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) -> Unit) -> Unit?)
fun onHeadersReceived(filter: WebRequestFilter, listener: (details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) -> Unit) -> Unit?)

The listener will be called with listener(details, callback) when HTTP response headers of a request have been received.

Link copied to clipboard

The listener will be called with listener(details) when first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.

Link copied to clipboard
fun onSendHeaders(listener: (details: OnSendHeadersListenerDetails) -> Unit?)
fun onSendHeaders(filter: WebRequestFilter, listener: (details: OnSendHeadersListenerDetails) -> Unit?)

The listener will be called with listener(details) just before a request is going to be sent to the server, modifications of previous onBeforeSendHeaders response are visible by the time this listener is fired.