CompareEtagValue same method as above, but accepts the raw If-None-Match value instead of the request header.
(ifNoneMatch string, respHeader http.Header)
| 19 | // CompareEtagValue same method as above, but accepts the raw If-None-Match value |
| 20 | // instead of the request header. |
| 21 | func 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. |
no test coverage detected