NetLensMockJsonCodec class
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:
{
"netlensMocks": 1,
"mocks": [
{
"method": "GET",
"url": "https://api.example.com/users/*",
"response": {"status": 200, "body": "[]"}
}
]
}
Only method, url and response.status are required.
- Implemented types
Constructors
- NetLensMockJsonCodec()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
canImport(
Object? json) → bool -
Returns true when
jsonhas the format of this importer.override -
decode(
String content) → List< NetLensMock> - Returns mocks of a JSON document written by encode.
-
encode(
List< NetLensMock> mocks) → String -
Returns
mocksas a JSON document. -
import(
Object? json) → List< NetLensMock> -
Returns mocks found in
json.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited