KestrunRequest class

Represents a request model for Kestrun, containing HTTP method, path, query, headers, body, authorization, cookies, and form data.

public class KestrunRequest

Public Members

name description
static NewRequestSync(…) Synchronous helper for tests and simple call sites that prefer not to use async/await. Avoid in ASP.NET request pipelines; intended for unit tests only.
Authorization { get; } Gets the authorization header value for the request, if present.
Body { get; set; } Gets the body content of the request as a string.
ContentLength { get; } Gets the content length of the request, if available.
ContentType { get; } Gets the content type of the request (e.g., “application/json”).
Cookies { get; set; } Gets the cookies for the request as an IRequestCookieCollection, if present.
Form { get; set; } Gets the form data for the request as a dictionary of key-value pairs, if present.
HasFormContentType { get; } Gets a value indicating whether the request has a form content type.
Headers { get; set; } Gets the headers for the request as a dictionary of key-value pairs.
Host { get; } Gets the host header value for the request.
IsHttps { get; } Gets a value indicating whether the request is made over HTTPS.
Method { get; } Gets the HTTP method for the request (e.g., GET, POST).
Path { get; } Gets the request path (e.g., “/api/resource”).
PathBase { get; } Gets the base path for the request (e.g., “/api”).
Protocol { get; } Gets the protocol used for the request (e.g., “HTTP/1.1”).
Query { get; set; } Gets the query parameters for the request as a dictionary of key-value pairs.
QueryString { get; } Gets the query string for the request (e.g., “?id=123”).
RouteValues { get; set; } Gets the route values for the request as a RouteValueDictionary, if present.
Scheme { get; } Gets the request scheme (e.g., “http”, “https”).
static NewRequest(…) Creates a new KestrunRequest instance from the specified HttpContext.

See Also