CompareLastModifiedValue same as above, but accepts the raw If-Modified-Since value
(ifModifiedSinceStr string, respHeader http.Header)
| 52 | |
| 53 | // CompareLastModifiedValue same as above, but accepts the raw If-Modified-Since value |
| 54 | func CompareLastModifiedValue(ifModifiedSinceStr string, respHeader http.Header) (bool, bool) { |
| 55 | if ifModifiedSinceStr == "" { |
| 56 | return false, false |
| 57 | } |
| 58 | |
| 59 | ifModifiedSince, err := http.ParseTime(ifModifiedSinceStr) |
| 60 | if err != nil { |
| 61 | return false, false |
| 62 | } |
| 63 | |
| 64 | lastModifiedStr := respHeader.Get(LastModified) |
| 65 | if lastModifiedStr == "" { |
| 66 | return false, false |
| 67 | } |
| 68 | |
| 69 | lastModified, err := http.ParseTime(lastModifiedStr) |
| 70 | if err != nil { |
| 71 | return false, false |
| 72 | } |
| 73 | |
| 74 | return true, !lastModified.After(ifModifiedSince) |
| 75 | } |
no test coverage detected