Table of Contents

Class HttpRequestExtensions

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

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

public static class HttpRequestExtensions
Inheritance
HttpRequestExtensions

Methods

AcceptMimeTypesOrderedByQuality(HttpRequest)

Returns the MIME type types from the HTTP Accept header of the request, ordered by their quality values, e.g., preferred MIME types are first.

public static IEnumerable<string> AcceptMimeTypesOrderedByQuality(this HttpRequest request)

Parameters

request HttpRequest

The Microsoft.AspNetCore.Http.HttpRequest to extend.

Returns

IEnumerable<String>

A sequence of strings representing the MIME types from the HTTP Accept header of the request, ordered by their quality values.

IsClientSideResourceCached(HttpRequest, ChecksumBuilder)

Determines whether a cached version of the requested resource is found client-side using the If-None-Match HTTP header.

public static bool IsClientSideResourceCached(this HttpRequest request, ChecksumBuilder builder)

Parameters

request HttpRequest

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

builder ChecksumBuilder

A ChecksumBuilder that represents the integrity of the client.

Returns

Boolean

true if a cached version of the requested content is found client-side; otherwise, false.

Exceptions

ArgumentNullException

request cannot be null -or builder cannot be null.

IsClientSideResourceCached(HttpRequest, DateTime)

Determines whether a cached version of the requested resource is found client-side using the If-Modified-Since HTTP header.

public static bool IsClientSideResourceCached(this HttpRequest request, DateTime lastModified)

Parameters

request HttpRequest

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

lastModified DateTime

A DateTime value that represents the modification date of the content.

Returns

Boolean

true if a cached version of the requested content is found client-side; otherwise, false.

Exceptions

ArgumentNullException

request cannot be null.

IsGetOrHeadMethod(HttpRequest)

Determines whether the specified request is served by either a GET or a HEAD method.

public static bool IsGetOrHeadMethod(this HttpRequest request)

Parameters

request HttpRequest

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

Returns

Boolean

true if the specified request is served by either a GET or a HEAD method; otherwise, false.

Exceptions

ArgumentNullException

request cannot be null.