MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / CompareEtagValue

Function CompareEtagValue

httpheaders/conditional.go:21–32  ·  view source on GitHub ↗

CompareEtagValue same method as above, but accepts the raw If-None-Match value instead of the request header.

(ifNoneMatch string, respHeader http.Header)

Source from the content-addressed store, hash-verified

19// CompareEtagValue same method as above, but accepts the raw If-None-Match value
20// instead of the request header.
21func CompareEtagValue(ifNoneMatch string, respHeader http.Header) (bool, bool) {
22 if ifNoneMatch == "" {
23 return false, false
24 }
25
26 etag := respHeader.Get(Etag)
27 if etag == "" {
28 return false, false
29 }
30
31 return true, UnquoteEtag(etag) == UnquoteEtag(ifNoneMatch)
32}
33
34// UnquoteEtag removes quotes from the ETag value if they are present.
35// It also removes the weak ETag prefix "W/" if it is present.

Callers 1

CompareEtagFunction · 0.85

Calls 2

UnquoteEtagFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected