Class InterceptorMockStore

Namespace
Kuestenlogik.Bowire.Interceptor
Assembly
Kuestenlogik.Bowire.Interceptor.dll

In-memory registry of InterceptorMockRules consulted by the interceptor middleware on every request when BowireInterceptorOptions.MocksEnabled is on (#308, Phase D). Rules are matched in insertion order — the first match wins, so the workbench can compose specific overrides before broad catch-alls.

public sealed class InterceptorMockStore
Inheritance
InterceptorMockStore
Inherited Members

Remarks

Singleton-scoped (registered next to InterceptedFlowStore): one rule set per host process. The workbench's "Mocks" sub-tab in the Intercepted rail is the canonical CRUD surface — see BowireInterceptorEndpoints.MapBowireInterceptorEndpoints.

State is process-local — surviving a restart is out of scope for Phase D; if an operator wants a persisted set they export to a recording via the Mocks rail and reload it at startup. Phase E will add a JSON sidecar.

Constructors

InterceptorMockStore()

public InterceptorMockStore()

Methods

Add(InterceptorMockRule)

Add a rule. When the caller leaves Id blank, a fresh monotonic id is assigned. Returns the persisted rule (with id filled in) so the workbench can echo it back to the UI without a second round-trip.

public InterceptorMockRule Add(InterceptorMockRule rule)

Parameters

rule InterceptorMockRule

Returns

InterceptorMockRule

Clear()

Drop every rule (workbench "Clear all" button + tests).

public void Clear()

FindMatch(string, string)

Look up the first matching rule for a method + path. Returns null when nothing matches; the middleware then falls back to forwarding the request to the host's pipeline.

public InterceptorMockRule? FindMatch(string method, string path)

Parameters

method string
path string

Returns

InterceptorMockRule

Remove(string)

Remove a rule by id. Returns whether the rule existed.

public bool Remove(string id)

Parameters

id string

Returns

bool

Snapshot()

Snapshot of currently-registered rules in insertion order.

public IReadOnlyList<InterceptorMockRule> Snapshot()

Returns

IReadOnlyList<InterceptorMockRule>