RestFake class final

Serves /api/v1/ on the fake server.

Every secured operation needs Authorization: DPoP <token> of a known session and a valid proof bound to its key (08 7.3); proofs without the current or the previous nonce get 401 use_dpop_nonce with a DPoP-Nonce header. A waiting device gets 403 device_pending outside the allowed operations. Writes with Idempotency-Key repeat their stored answer (04 5.2). Faults of the FaultPlan apply after the checks.

Constructors

RestFake({required FakeWorld world, required ContractSchemas contract, required DpopVerifier verifier, required FaultPlan faults})
Creates the REST side.

Properties

contract → ContractSchemas
The API documents.
final
faults → FaultPlan
The faults.
final
handled → Set<String>
The operations with a handler.
no setter
hashCode → int
The hash code for this object.
no setterinherited
oneTimeSecrets → Set<String>
Operations whose successful answer carries a one-time secret: a replay of the same Idempotency-Key answers 409 conflict with reason: one_time_secret (06 7).
final
requests → List<FakeRequestRecord>
Every request answered, in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
verifier → DpopVerifier
The DPoP check.
final
violations → List<String>
Contract violations of requests and responses, as text with the pointer.
final
world → FakeWorld
The world.
final

Methods

handle(String operationId, FakeHandler handler) → void
Registers handler for operationId, replacing an earlier one (Design note 3: later tickets add operations this way). Throws an ArgumentError for an operation that is not in openapi.yaml.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serve(HttpRequest request, Uri baseUri) → Future<void>
Serves request; baseUri is the address of the fake.
tokenExpired(String token) → bool
Whether the exp of a token issued by the fake lies in the past.
toString() → String
A string representation of this object.
inherited

Operators

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