Delegate CallNextHandlerDelegate

Invokes the next compatible handler in the current routing pipeline.

Namespace: NanoRoute
Assembly: NanoRoute.dll
Syntax
public delegate Task<HttpResponseMessage> CallNextHandlerDelegate()
Returns
Type Description
Task<HttpResponseMessage>

The HttpResponseMessage produced by the next matching handler.

Remarks

This delegate is passed into RequestHandlerDelegate so handlers can opt into middleware-style composition. When the current handler does not call it, the pipeline stops at the current handler. Matching continues only within the route branch already selected for the request; sibling branches are not revisited.

Examples
routerBuilder.AddHandler("GET", "/api/users/{id:int}", async (requestContext, callNext) =>
{
    requestContext.Parameters["StartTime"] = DateTimeOffset.UtcNow;
    return await callNext();
});

Methods

Invoke()

Declaration
public virtual Task<HttpResponseMessage> Invoke()
Returns
Type Description
Task<HttpResponseMessage>
In this article
Back to top Generated by DocFX