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 = Future<BaseResponse> Function(FinalizedRequest request, Match match)
RequestHandler = Future<BaseResponse> Function(FinalizedRequest request)
WebSocketConnectHandler = Future Function(Uri uri, {Map<String, dynamic> headers, Iterable<String> protocols})
WebSocketPatternConnectHandler = Future Function(Uri uri, {Map<String, dynamic>? headers, Match? match, Iterable<String>? protocols})