Class BowireInterceptorApplicationBuilderExtensions

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

IApplicationBuilder extensions that wire the in-process HTTP interceptor (#153) into an ASP.NET host's pipeline. Pair with AddBowire(IServiceCollection) and MapBowire(IEndpointRouteBuilder, string, Action<BowireOptions>?): register Bowire's services, mount the workbench, then call app.UseBowireInterceptor() as early in the pipeline as you want the interceptor to see the request (typically between UseRouting() and UseEndpoints()).

public static class BowireInterceptorApplicationBuilderExtensions
Inheritance
BowireInterceptorApplicationBuilderExtensions
Inherited Members

Remarks

Phase A (this shipment) is pass-through only: every request the host receives is recorded into InterceptedFlowStore with method, path, headers, request body, response status, response headers, response body, and end-to-end latency. The workbench's new "Intercepted" rail surfaces the captures live via SSE.

Phase B (this shipment) wires the middleware to BowireRecordingSession: when the operator starts a Capture-mode recording in the workbench, every intercepted flow auto-appends as a recording step. No client changes, no proxy setup — drive the host from any client and the recording fills.

Phase D (#308) — mock injection. InterceptorMockStore rules can short-circuit the pipeline before _next runs: the rule's response is served directly to the client. The Workbench's "Mocks" sub-tab in the Intercepted rail is the CRUD surface; rules can also be seeded from any captured flow via the rail's "Mock this route" affordance.

Phase C (standalone reverse-proxy mode) remains out of scope — tracked separately.

Methods

AddBowireInterceptorCore(IServiceCollection)

Registers the interceptor's supporting services into a host's DI container without mounting the middleware. Useful for tests that want the store + options resolvable but drive the middleware directly. Production hosts should call UseBowireInterceptor(IApplicationBuilder, Action<BowireInterceptorOptions>?) instead — it covers this internally.

public static IServiceCollection AddBowireInterceptorCore(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

UseBowireInterceptor(IApplicationBuilder, Action<BowireInterceptorOptions>?)

Activates the Bowire HTTP interceptor on the host's pipeline.

public static IApplicationBuilder UseBowireInterceptor(this IApplicationBuilder app, Action<BowireInterceptorOptions>? configure = null)

Parameters

app IApplicationBuilder

The application builder to mount the middleware on.

configure Action<BowireInterceptorOptions>

Optional callback to customise BowireInterceptorOptions before the middleware is registered. Mutates the options the middleware will resolve through IOptions<…>; subsequent edits to the same instance take effect on the next request.

Returns

IApplicationBuilder

The same app instance, so calls can be chained.

Examples

builder.Services.AddBowire();
var app = builder.Build();

app.UseBowireInterceptor();  // Intercept every request through this host.
app.MapBowire("/bowire");    // Workbench at /bowire.
// ... host's own endpoints ...
app.Run();

Remarks

Idempotent registration of the supporting services (InterceptedFlowStore, BowireInterceptorOptions) — calling UseBowireInterceptor twice is safe but only registers the middleware once.