Class
HttpRequest
Represents an HTTP request received by a Sisk server.
public sealed class HttpRequest : IDisposableInheritance #
Implements #
Inherited Members #
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Properties #
| Name | Description |
|---|---|
| Authority | Get the requested host header with the port from this HTTP request. |
| Bag | Gets the managed object which holds data for an entire HTTP session. |
| Body | Gets the HTTP request body as string, decoded by the request content encoding. |
| ContentLength | Gets the content length in bytes count. |
| Context | Gets the HttpContext for this request. |
| Cookies | Gets an StringKeyStoreCollection object with all cookies set in this request. |
| Culture | Gets the proper CultureInfo to handle this request. |
| DefaultJsonSerializerOptions | Gets or sets the default options used for JSON serialization. |
| DisconnectToken | Gets a cancellation token that is signaled when the client disconnects. |
| FullPath | Gets the raw, full HTTP request path with the query string. |
| FullUrl | Gets the full URL for this request, with scheme, host, port, path and query. |
| HasContents | Gets a boolean indicating whether this request has body contents. |
| Headers | Gets the HTTP request headers. |
| Host | Get the requested host (without port) for this HttpRequest. |
| IsContentAvailable | Gets a boolean indicating whether this request has body contents and whether it has already been read into memory by the server. |
| IsSecure | Gets a boolean indicating whether this request was locally made by an secure transport context (SSL/TLS) or not. |
| Method | Gets the HTTP request method. |
| Path | Gets the HTTP request path without the query string. |
| Query | Gets the HTTP request query value collection. |
| QueryString | Gets the HTTP request URL raw query string, including the ‘?’ char. |
| RawBody | Gets the HTTP request body as a byte array. |
| RemoteAddress | Gets the incoming local IP address from the request. |
| RequestEncoding | Gets an string Encoding that can be used to decode text in this HTTP request. |
| RequestId | Gets a unique identifier for this request. |
| RequestedAt | Gets the moment which the request was received by the server. |
| RouteParameters | Gets the StringValueCollection object which represents the current route parameters. |
| Uri | Gets the Uri component for this HTTP request requested URL. |
Methods #
| Name | Description |
|---|---|
| Abort() | Immediately closes the connection with the client and does not send any response. |
| ~HttpRequest() | |
| GetBodyContents() | Gets the request contents of the body as a byte array. |
| GetBodyContentsAsync(CancellationToken) | Asynchronously reads the request contents as a memory byte array. |
| GetEventSource(string?) | Gets an Event Source interface for this request. Calling this method will put this HttpRequest instance in it’s event source listening state. |
| GetEventSourceAsync(string?) | Asynchronously gets an Event Source interface for this request. Calling this method will put this HttpRequest instance in its event source listening state. |
| GetFormContent() | Reads the request body and extracts form data parameters from it. |
| GetFormContentAsync(CancellationToken) | Asynchronously reads the request body and extracts form data parameters from it. |
| GetJsonContent<T>(JsonTypeInfo<T>) | Deserializes the request body into an object of type T using the provided JsonTypeInfo. |
| GetJsonContent<T>(JsonSerializerOptions?) | Deserializes the request body into an object of type T using the provided JsonSerializerOptions. |
| GetJsonContent<T>() | Deserializes the request body into an object of type T using the default JsonSerializerOptions from DefaultJsonSerializerOptions. |
| GetJsonContentAsync<T>(JsonTypeInfo<T>, CancellationToken) | Asynchronously deserializes the request body into an object of type T using the provided JsonTypeInfo. |
| GetJsonContentAsync<T>(JsonSerializerOptions?, CancellationToken) | Asynchronously deserializes the request body into an object of type T using the provided JsonSerializerOptions. |
| GetJsonContentAsync<T>(CancellationToken) | Asynchronously deserializes the request body into an object of type T using the default JsonSerializerOptions. |
| GetMultipartFormContent() | Reads the request body and obtains a MultipartFormCollection from it. |
| GetMultipartFormContentAsync(CancellationToken) | Asynchronously reads the request body and obtains a MultipartFormCollection from it. |
| GetRawHttpRequest(bool, bool) | Gets a visual representation of this request. |
| GetRequestStream() | Gets the HTTP request content stream. This property is only available while the content has not been imported by the HTTP server and will invalidate the body content cached in this object. |
| GetResponseStream() | Gets an HTTP response stream for this HTTP request. |
| GetWebSocket(string?, string?) | Accepts and acquires a websocket for this request. Calling this method will put this HttpRequest instance in streaming state. |
| GetWebSocketAsync(string?, string?) | Asynchronously accepts and acquires a websocket for this request. Calling this method will put this HttpRequest instance in streaming state. |
| SendTo(RouteAction) | Calls another handler for this request, preserving the current call-stack frame, and then returns the response from it. This method manages to prevent possible stack overflows. |
| ToString() | Gets an string representation of this HttpRequest object. |