Class HttpResponseExtensions
Provides small response helpers for middleware short-circuits.
Inherited Members
Namespace: Eigenverft.WebLib.Infrastructure.Hosting
Assembly: Eigenverft.WebLib.Infrastructure.dll
Syntax
public static class HttpResponseExtensions
Methods
| Edit this page View SourceWriteHtmlStatusResponseAsync(HttpResponse, int, CancellationToken)
Writes a minimal HTML response containing the supplied status code and ASP.NET Core reason phrase.
Declaration
public static Task WriteHtmlStatusResponseAsync(this HttpResponse response, int statusCode, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpResponse | response | The response to write. |
| int | statusCode | The HTTP status code. |
| CancellationToken | cancellationToken | A token that can cancel the response write. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the response write. |
Remarks
This helper is intended for explicit middleware short-circuits. General application error handling should use ASP.NET Core status-code pages or Problem Details instead.