KestrunHostMapExtensions class

Provides extension methods for mapping routes and handlers to the KestrunHost.

public static class KestrunHostMapExtensions

Public Members

name description
static AddAntiforgeryTokenRoute(…) Adds a GET endpoint that issues the antiforgery cookie and returns a JSON payload: { token: “…”, headerName: “X-CSRF-TOKEN” }. The endpoint itself is exempt from antiforgery validation.
static AddHtmlTemplateRoute(…) Adds an HTML template route to the KestrunHost for the specified pattern and HTML file path. (2 methods)
static AddMapRoute(…) Adds a native route to the KestrunHost for the specified pattern and HTTP verb. (6 methods)
static ApplyKestrunConventions(…) Applies the same route conventions used by the AddMapRoute helpers to an arbitrary endpoint.
static GetMapRouteOptions(…) Retrieves the MapRouteOptions associated with a given route pattern and HTTP verb, if registered.
static MapExists(…) Checks if a route with the specified pattern and optional HTTP method exists in the KestrunHost. (2 methods)
static TryParseEndpointSpec(…) Tries to parse an endpoint specification string into its components: host, port, and HTTPS flag.
static class EndpointSpecParser Public utility facade for endpoint specification parsing. This provides a stable API surface over the internal helper logic used by host route constraint processing.
delegate KestrunHandler Represents a delegate that handles a Kestrun request with the provided context.

See Also