0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

make 'cached' a bool

This commit is contained in:
Will Norris 2020-02-24 07:57:46 -08:00
parent 8484518c93
commit 4e97a7ea8f

View file

@ -197,12 +197,12 @@ func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) {
// close the original resp.Body, even if we wrap it in a NopCloser below
defer resp.Body.Close()
cached := resp.Header.Get(httpcache.XFromCache)
cached := resp.Header.Get(httpcache.XFromCache) == "1"
if p.Verbose {
p.logf("request: %+v (served from cache: %t)", *actualReq, cached == "1")
p.logf("request: %+v (served from cache: %t)", *actualReq, cached)
}
if cached == "1" {
if cached {
requestServedFromCacheCount.Inc()
}