Struct RequestContext
Carries request-specific data through the NanoRoute handler pipeline.
Inherited Members
Namespace: NanoRoute
Assembly: NanoRoute.dll
Syntax
public readonly struct RequestContext
Remarks
Handlers can use Parameters to share values, Services to resolve dependencies, and Cancellation to observe caller-initiated cancellation. Parameters is a shared mutable dictionary for the active pipeline so handlers may overwrite values that were written earlier by other handlers.
Properties
Cancellation
Gets the cancellation token for the active request.
Declaration
public CancellationToken Cancellation { get; init; }
Property Value
| Type | Description |
|---|---|
| CancellationToken |
Parameters
Gets the parsed route, query, and handler-shared values for the active request.
Declaration
public required Dictionary<string, object?> Parameters { get; init; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, object> |
Request
Gets the request being routed.
Declaration
public required HttpRequestMessage Request { get; init; }
Property Value
| Type | Description |
|---|---|
| HttpRequestMessage |
Services
Gets the service provider available to handlers and parsers.
Declaration
public required IServiceProvider Services { get; init; }
Property Value
| Type | Description |
|---|---|
| IServiceProvider |