From 4e97a7ea8f8dcd386f3536f58e70588509d2a1a5 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Mon, 24 Feb 2020 07:57:46 -0800 Subject: [PATCH] make 'cached' a bool --- imageproxy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imageproxy.go b/imageproxy.go index 1aa8c78..3163dba 100644 --- a/imageproxy.go +++ b/imageproxy.go @@ -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() }