Class HttpResponseExtensions
Extension methods for the Microsoft.AspNetCore.Http.HttpResponse class.
Inheritance
Namespace: Cuemon.AspNetCore.Http
Assembly: Cuemon.AspNetCore.dll
Syntax
public static class HttpResponseExtensions
Methods
| Improve this DocIsNotModifiedStatusCode(HttpResponse)
Determines whether the HTTP response equals a 304 Not Modified.
Declaration
public static bool IsNotModifiedStatusCode(this HttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpResponse | response | An instance of the Microsoft.AspNetCore.Http.HttpResponse object. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsSuccessStatusCode(HttpResponse)
Determines whether the HTTP response was successful.
Declaration
public static bool IsSuccessStatusCode(this HttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpResponse | response | An instance of the Microsoft.AspNetCore.Http.HttpResponse object. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetEntityTagHeaderInformation(HttpResponse, HttpRequest, ChecksumBuilder, Boolean)
This method will either add or update the necessary HTTP response headers needed to provide entity tag header information.
Declaration
public static void SetEntityTagHeaderInformation(this HttpResponse response, HttpRequest request, ChecksumBuilder builder, bool isWeak = false)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpResponse | response | The Microsoft.AspNetCore.Http.HttpResponse to extend. |
Microsoft.AspNetCore.Http.HttpRequest | request | An instance of the Microsoft.AspNetCore.Http.HttpRequest object. |
ChecksumBuilder | builder | A ChecksumBuilder that represents the integrity of the client. |
System.Boolean | isWeak | A value that indicates if this entity-tag header is a weak validator. |
SetLastModifiedHeaderInformation(HttpResponse, HttpRequest, DateTime)
This method will either add or update the necessary HTTP response headers needed to provide last-modified information.
Declaration
public static void SetLastModifiedHeaderInformation(this HttpResponse response, HttpRequest request, DateTime lastModified)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpResponse | response | The Microsoft.AspNetCore.Http.HttpResponse to extend. |
Microsoft.AspNetCore.Http.HttpRequest | request | An instance of the Microsoft.AspNetCore.Http.HttpRequest object. |
System.DateTime | lastModified | A value that represents when the resource was either created or last modified. |
WriteBodyAsync(HttpResponse, Func<Byte[]>)
Asynchronously writes a sequence of bytes to the response body stream and advances the current position within this stream by the number of bytes written.
Declaration
public static Task WriteBodyAsync(this HttpResponse response, Func<byte[]> body)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpResponse | response | The Microsoft.AspNetCore.Http.HttpResponse to extend. |
System.Func<System.Byte[]> | body | The function delegate that resolves the bytes to write. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task that represents the asynchronous write operation. |