stream

suspend fun stream(callback: StreamCallback): Response

Executes a streaming HTTP request, downloading the response body in chunks.

The HTTP method, URL, and options for the request are taken from the properties of this Request instance. The response body from the server is not returned in the Response object, but is instead passed to the StreamCallback whenever new data arrives.

Return

A Response object containing the response from the server, except for the response body, which is passed to the StreamCallback function.

Parameters

callback

A StreamCallback function that will be called when the response data arrives.

Throws

If there is an error with the request, a HttpException is thrown.