FakeMiddleware class

A stand-in for genai-middleware, routing on the request path.

Records every request so tests can assert on the wire, and lets each endpoint be scripted independently.

Implemented types

Constructors

FakeMiddleware()

Properties

chatBodies → List<Map<String, dynamic>>
Decoded bodies of the chat and chat-streaming requests.
no setter
chatCallCount → int
How many times POST /chat was called.
no setter
chatReplies ↔ List<Map<String, dynamic>>
Replies for POST /chat, consumed in order. The last one repeats.
getter/setter pair
chatStatus ↔ int
Status returned by POST /chat.
getter/setter pair
chunkDelay ↔ Duration
Artificial latency between streamed chunks.
getter/setter pair
csatAccepted ↔ bool
Whether POST /csat accepts.
getter/setter pair
csatBodies → List<Map<String, dynamic>>
Decoded bodies of the CSAT submissions.
no setter
hashCode → int
The hash code for this object.
no setterinherited
requests → List<KataCxRequest>
Every request seen, oldest first.
final
responseDelay ↔ Duration
Artificial latency before any response.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
settingsBody ↔ String
Body returned by GET /settings.
getter/setter pair
settingsStatus ↔ int
Status returned by GET /settings.
getter/setter pair
streamCallCount → int
How many times POST /chat-streaming was called.
no setter
streamFailureStatus ↔ int?
When set, streaming fails with this status instead of yielding.
getter/setter pair
streamReplies ↔ List<List<String>>
Chunks for POST /chat-streaming, consumed in order per call.
getter/setter pair

Methods

close() → void
Releases the underlying client.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(KataCxRequest request) → Future<KataCxResponse>
Performs request and waits for the whole body.
override
stream(KataCxRequest request) → Stream<Uint8List>
Performs request and yields body bytes as they arrive.
override
toString() → String
A string representation of this object.
inherited

Operators

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