w_transport.mock library

Easily mock out the platform-specific details of w_transport. Exposes a single configuration method that must be called before instantiating any of the transport classes.

import 'package:w_transport/mock.dart'
    show configureWTransportForTest;

void main() {
  configureWTransportForTest();
}

Classes

FinalizedRequest
A finalized, read-only representation of a request.
MockBaseRequest
MockClient
A mock implementation of an HTTP client. Factory methods simply return the mock implementations of each request. Since the mock request implementations don't ever actually send an HTTP request, this client doesn't need to do anything else.
MockFormRequest
MockHttpHandler
MockJsonRequest
MockPlainTextRequest
MockResponse
MockStreamedRequest
MockStreamedResponse
MockTransports
MockWebSocketConnection
MockWebSocketHandler
MockWebSocketServer
MockWSocket

Functions

configureWTransportForTest() → void
Configure w_transport for use in tests, allowing you to easily mock out the behavior of the w_transport classes.

Typedefs

PatternRequestHandler(FinalizedRequest request, Match match) Future<BaseResponse>
RequestHandler(FinalizedRequest request) Future<BaseResponse>
WebSocketConnectHandler(Uri uri, {Map<String, dynamic> headers, Iterable<String> protocols}) Future
WebSocketPatternConnectHandler(Uri uri, {Map<String, dynamic> headers, Match match, Iterable<String> protocols}) Future