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

Function CompareLastModifiedValue

httpheaders/conditional.go:54–75  ·  view source on GitHub ↗

CompareLastModifiedValue same as above, but accepts the raw If-Modified-Since value

(ifModifiedSinceStr string, respHeader http.Header)

Source from the content-addressed store, hash-verified

52
53// CompareLastModifiedValue same as above, but accepts the raw If-Modified-Since value
54func 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}

Callers 1

CompareLastModifiedFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected