Interface IBowireMockLiveSchemaHandler

Namespace
Kuestenlogik.Bowire.Mocking
Assembly
Kuestenlogik.Bowire.dll

Optional companion to IBowireMockSchemaSource for schema kinds whose responses can't be pre-baked into a recording (GraphQL is the canonical case — every selection set yields a different response shape, so the mock has to interpret each request as it arrives).

public interface IBowireMockLiveSchemaHandler

Remarks

The mock server registers any matching live-handler as middleware in front of the recording-replay middleware. If TryHandleAsync(HttpContext, CancellationToken) returns true, the request is considered handled and the rest of the pipeline is skipped.

Properties

Kind

Schema kind id this handler is paired with — should match a registered Kind.

string Kind { get; }

Property Value

string

Methods

LoadAsync(string, ILogger, CancellationToken)

Load schema state from path. Called once at MockServer startup. Implementations should cache parsed schema data on the instance for use by TryHandleAsync(HttpContext, CancellationToken).

Task LoadAsync(string path, ILogger logger, CancellationToken ct)

Parameters

path string
logger ILogger
ct CancellationToken

Returns

Task

TryHandleAsync(HttpContext, CancellationToken)

Handle the incoming request if it matches this schema kind. Return true when handled (response written), false to fall through to downstream middleware.

Task<bool> TryHandleAsync(HttpContext ctx, CancellationToken ct)

Parameters

ctx HttpContext
ct CancellationToken

Returns

Task<bool>