NetLensMockServer class

Local HTTP server which answers requests with mocks. It works with any HTTP client, including HttpClient from dart:io: point the base URL of the app at uri. The host of the request is ignored, so mocks recorded against any backend match.

Requests which no mock answers get 404.

Constructors

NetLensMockServer({required NetLensMockResolver resolver})

Properties

hashCode → int
The hash code for this object.
no setterinherited
isRunning → bool
Whether the server is running.
no setter
resolver → NetLensMockResolver
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
uri → Uri?
Base URL of the running server, or null when it isn't running.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start({Object? address, int port = 0}) → Future<Uri>
Starts the server on address and port. A port of 0 picks a free port. Returns the base URL of the server.
stop() → Future<void>
Stops the server.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited