Class HttpResponseExtensions
- Namespace
- Cuemon.Extensions.AspNetCore.Http
- Assembly
- Cuemon.Extensions.AspNetCore.dll
Extension methods for the HttpResponse class.
public static class HttpResponseExtensions
- Inheritance
-
HttpResponseExtensions
Methods
AddOrUpdateEntityTagHeader(HttpResponse, HttpRequest, ChecksumBuilder, bool)
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
responseHttpResponseThe HttpResponse to extend.
requestHttpRequestAn instance of the HttpRequest object.
builderChecksumBuilderA ChecksumBuilder that represents the integrity of the client.
isWeakboolA value that indicates if this entity-tag header is a weak validator.
Exceptions
- ArgumentNullException
responsecannot be null -or-requestcannot be null -or-buildercannot 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
responseHttpResponseThe HttpResponse to extend.
requestHttpRequestAn instance of the HttpRequest object.
lastModifiedDateTimeA value that represents when the resource was either created or last modified.
Exceptions
- ArgumentNullException
responsecannot be null -or-requestcannot 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
responseHttpResponseThe HttpResponse to extend.
messageHttpResponseMessageThe HttpResponseMessage to convert into an HTTP equivalent HttpResponse.
transformerAction<HttpResponseMessage, HttpResponse>The delegate that converts a HttpResponseMessage to an HTTP equivalent 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 Task WriteBodyAsync(this HttpResponse response, Func<byte[]> body)
Parameters
responseHttpResponseThe HttpResponse to extend.
bodyFunc<byte[]>The function delegate that resolves the bytes to write.
Returns
- Task
A task that represents the asynchronous write operation.