Table of Contents

Class HttpResponseExtensions

Namespace
Cuemon.Extensions.AspNetCore.Http
Assembly
Cuemon.Extensions.AspNetCore.dll

Extension methods for the Microsoft.AspNetCore.Http.HttpResponse class.

public static class HttpResponseExtensions
Inheritance
Object
HttpResponseExtensions

Methods

AddOrUpdateEntityTagHeader(HttpResponse, HttpRequest, ChecksumBuilder, Boolean)

Attempts to add or update the necessary HTTP response headers needed to provide entity tag header information.

public static void AddOrUpdateEntityTagHeader(this HttpResponse response, HttpRequest request, ChecksumBuilder builder, bool isWeak = false)

Parameters

response HttpResponse

The Microsoft.AspNetCore.Http.HttpResponse to extend.

request HttpRequest

An instance of the Microsoft.AspNetCore.Http.HttpRequest object.

builder ChecksumBuilder

A ChecksumBuilder that represents the integrity of the client.

isWeak Boolean

A value that indicates if this entity-tag header is a weak validator.

Exceptions

System.ArgumentNullException

response cannot be null -or- request cannot be null -or- builder cannot be null.

AddOrUpdateLastModifiedHeader(HttpResponse, HttpRequest, DateTime)

Attempts to add or update the necessary HTTP response headers needed to provide last-modified information.

public static void AddOrUpdateLastModifiedHeader(this HttpResponse response, HttpRequest request, DateTime lastModified)

Parameters

response HttpResponse

The Microsoft.AspNetCore.Http.HttpResponse to extend.

request HttpRequest

An instance of the Microsoft.AspNetCore.Http.HttpRequest object.

lastModified DateTime

A value that represents when the resource was either created or last modified.

Exceptions

System.ArgumentNullException

response cannot be null -or- request cannot be null.

OnStartingInvokeTransformer(HttpResponse, HttpResponseMessage, Action<HttpResponseMessage, HttpResponse>)

Transfers the specified message to the HTTP response pipeline using the transformer delegate.

public static void OnStartingInvokeTransformer(this HttpResponse response, HttpResponseMessage message, Action<HttpResponseMessage, HttpResponse> transformer)

Parameters

response HttpResponse

The Microsoft.AspNetCore.Http.HttpResponse to extend.

message HttpResponseMessage

The System.Net.Http.HttpResponseMessage to convert into an HTTP equivalent Microsoft.AspNetCore.Http.HttpResponse.

transformer Action<HttpResponseMessage, HttpResponse>

The delegate that converts a System.Net.Http.HttpResponseMessage to an HTTP equivalent Microsoft.AspNetCore.Http.HttpResponse.

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.

public static async Task WriteBodyAsync(this HttpResponse response, Func<byte[]> body)

Parameters

response HttpResponse

The Microsoft.AspNetCore.Http.HttpResponse to extend.

body Func<Byte[]>

The function delegate that resolves the bytes to write.

Returns

Task

A task that represents the asynchronous write operation.