MockClient.streaming constructor

MockClient.streaming(
  1. MockClientStreamHandler fn
)

Creates a MockClient with a handler that receives StreamedRequests and sends StreamedResponses.

Implementation

MockClient.streaming(MockClientStreamHandler fn)
    : this._((request, bodyStream) async {
        final response = await fn(request, bodyStream);
        return StreamedResponse(response.stream, response.statusCode,
            contentLength: response.contentLength,
            request: request,
            headers: response.headers,
            isRedirect: response.isRedirect,
            persistentConnection: response.persistentConnection,
            reasonPhrase: response.reasonPhrase);
      });