netlens library

Classes

NetLens
NetLensCallMockMapper
Builds mocks from calls caught by NetLens.
NetLensCallReplayer
Implemented by adapters which can send a caught call again with their own HTTP client. The new call goes through the adapter, so it is caught by NetLens like any other call.
NetLensDefaultMockMatcher
Matcher which compares method, host, path and query parameters, and optionally the body.
NetLensFileMockRepository
Repository which saves mocks to a JSON file, so mocks recorded once can be replayed after the app is restarted. The file has the format of NetLensMockJsonCodec, so it can be shared and loaded in tests.
NetLensHarMockImporter
Reads mocks from an HTTP Archive (HAR 1.2), for example one exported by NetLens, Chrome DevTools, Proxyman or Charles. Entries without a response are skipped.
NetLensLog
Definition of log data holder.
NetLensMemoryMockRepository
Repository which keeps mocks in memory. It's the default repository, so mocks are gone when the app is closed.
NetLensMemoryStorage
Storage which uses memory to store calls data. It's a default storage method.
NetLensMock
Endpoint which answers matching requests with a recorded response, so the app can run without the backend.
NetLensMockConflict
Mocks of several sources which can't all be kept. The user chooses one of options.
NetLensMockConflictOption
One way to settle a conflict: the mocks of the sources which agree.
NetLensMockImporter
Reads mocks from a decoded JSON document of one format.
NetLensMockJsonCodec
Reads and writes mocks in the NetLens mocks format, a JSON document which can be edited by hand, kept next to tests or loaded from app assets:
NetLensMockMatcher
Decides whether a mock answers a request.
NetLensMockMergePlan
Result of NetLensMockMerger.plan: the merged mocks and the conflicts which the user settles before the mocks are saved.
NetLensMockMerger
Merges mocks of several sources, for example collections recorded by teammates who each tested another feature.
NetLensMockRecorder
Saves calls and imported mocks to a repository. A mock for a request which already has one replaces it, so recording an endpoint again updates it.
NetLensMockRepository
Place where mocks are kept.
NetLensMockRequest
Request made by the app which may be answered by a mock.
NetLensMockResolver
Finds the response which answers a request. HTTP client adapters depend on this interface only, so they can be tested and used without the rest of NetLens.
NetLensMockResponse
Response which a mock sends back instead of the network.
NetLensMocks
Records calls as mock endpoints and replays them, so the app can be run and tested offline. It's the entry point of the mocks feature: the inspector, the HTTP client adapters and NetLensMockServer all go through it.
NetLensMockServer
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.
NetLensMockSource
Mocks read from one place, for example a collection shared by a teammate.
NetLensParser
Body parser helper used to parsing body data.
NetLensPostmanCollectionCodec
Reads and writes mocks as a Postman collection (v2.1), which Postman, Insomnia, Bruno and other API clients can import. Each mock becomes a request with its response saved as an example, so the collection can also back a Postman mock server. Requests are grouped in a folder per host.
NetLensRedaction
Describes which values of a call are sensitive. Sensitive values are replaced with mask in shared and exported calls (text log, cURL, HAR, copy) and are hidden in the inspector until they are revealed.
NetLensReplayRequest
Request which is sent again by an NetLensCallReplayer. It is built from a caught call and can be edited before it is sent.

Enums

NetLensMockBodyEncoding
How NetLensMockResponse.body is stored.
NetLensMockConflictType
Why mocks of several sources can't all be kept.
NetLensMockFallback
What happens in NetLensMockMode.replay when no mock matches a request.
NetLensMockMode
What NetLens does with mocks.