Class ETagHelper
RFC 9110-compliant entity tag comparison helpers.
public static class ETagHelper
- Inheritance
-
ETagHelper
- Inherited Members
Methods
IfMatchSatisfied(IList<EntityTagHeaderValue>, string)
Checks whether the If-Match header matches the current ETag
using strong comparison per RFC 9110 §13.1.1.
public static bool IfMatchSatisfied(IList<EntityTagHeaderValue> ifMatchHeader, string currentETag)
Parameters
ifMatchHeaderIList<EntityTagHeaderValue>Raw If-Match header values.
currentETagstringThe current resource ETag (unquoted).
Returns
- bool
trueif the precondition is satisfied (request should proceed).
IfNoneMatchMatches(IList<EntityTagHeaderValue>, string)
Checks whether the If-None-Match header matches the current ETag
using weak comparison per RFC 9110 §13.1.2.
public static bool IfNoneMatchMatches(IList<EntityTagHeaderValue> ifNoneMatchHeader, string currentETag)
Parameters
ifNoneMatchHeaderIList<EntityTagHeaderValue>Raw If-None-Match header values.
currentETagstringThe current resource ETag (unquoted).
Returns
- bool
trueif any tag matches (meaning 304 should be returned).
ParseIfMatch(HttpRequest)
Parses the If-Match header from an HTTP request and returns
EntityTagValue instances for use with
OptionalETag/RequireETag.
public static EntityTagValue[]? ParseIfMatch(HttpRequest request)
Parameters
requestHttpRequestThe HTTP request containing the If-Match header.
Returns
- EntityTagValue[]
nullif no If-Match header is present; an array of EntityTagValue instances (weak tags excluded per §13.1.1); an empty array if the header is present but contains only weak tags.
ParseIfModifiedSince(HttpRequest)
Parses the If-Modified-Since header.
public static DateTimeOffset? ParseIfModifiedSince(HttpRequest request)
Parameters
requestHttpRequest
Returns
ParseIfNoneMatch(HttpRequest)
Parses the If-None-Match header from an HTTP request.
public static EntityTagValue[]? ParseIfNoneMatch(HttpRequest request)
Parameters
requestHttpRequest
Returns
- EntityTagValue[]
null if absent; a wildcard EntityTagValue if wildcard; array of entity tag values (both strong and weak).
ParseIfUnmodifiedSince(HttpRequest)
Parses the If-Unmodified-Since header.
public static DateTimeOffset? ParseIfUnmodifiedSince(HttpRequest request)
Parameters
requestHttpRequest