Class HttpRequestExtensions
- Namespace
- Cuemon.Extensions.AspNetCore.Http
- Assembly
- Cuemon.Extensions.AspNetCore.dll
Extension methods for the 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
requestHttpRequestThe 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
requestHttpRequestAn instance of the HttpRequest object.
builderChecksumBuilderA ChecksumBuilder that represents the integrity of the client.
Returns
- bool
trueif a cached version of the requested content is found client-side; otherwise,false.
Exceptions
- ArgumentNullException
requestcannot be null -orbuildercannot 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
requestHttpRequestAn instance of the HttpRequest object.
lastModifiedDateTimeA DateTime value that represents the modification date of the content.
Returns
- bool
trueif a cached version of the requested content is found client-side; otherwise,false.
Exceptions
- ArgumentNullException
requestcannot 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
requestHttpRequestAn instance of the HttpRequest object.
Returns
- bool
trueif the specifiedrequestis served by either a GET or a HEAD method; otherwise,false.
Exceptions
- ArgumentNullException
requestcannot be null.