summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/httpcache/httpcache.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/httpcache/httpcache.go')
-rw-r--r--modules/caddyhttp/httpcache/httpcache.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/caddyhttp/httpcache/httpcache.go b/modules/caddyhttp/httpcache/httpcache.go
index 1b2cfd2..0b49c7e 100644
--- a/modules/caddyhttp/httpcache/httpcache.go
+++ b/modules/caddyhttp/httpcache/httpcache.go
@@ -130,8 +130,7 @@ func (c *Cache) getter(ctx groupcache.Context, key string, dest groupcache.Sink)
// we need to record the response if we are to cache it; only cache if
// request is successful (TODO: there's probably much more nuance needed here)
- var rr caddyhttp.ResponseRecorder
- rr = caddyhttp.NewResponseRecorder(combo.rw, buf, func(status int) bool {
+ rr := caddyhttp.NewResponseRecorder(combo.rw, buf, func(status int, header http.Header) bool {
shouldBuf := status < 300
if shouldBuf {
@@ -141,7 +140,7 @@ func (c *Cache) getter(ctx groupcache.Context, key string, dest groupcache.Sink)
// the rest will be the body, which will be written
// implicitly for us by the recorder
err := gob.NewEncoder(buf).Encode(headerAndStatus{
- Header: rr.Header(),
+ Header: header,
Status: status,
})
if err != nil {