From 18b756d3e6b4fb5c6d6435d7f5cd9bb2fa19e39d Mon Sep 17 00:00:00 2001 From: Victor Springer Date: Sun, 21 Jul 2019 20:12:24 +0200 Subject: [PATCH] reset request body with reader copy --- cache.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cache.go b/cache.go index cdb09a0..6cdb8ad 100644 --- a/cache.go +++ b/cache.go @@ -97,7 +97,9 @@ func (c *Client) Middleware(next http.Handler) http.Handler { next.ServeHTTP(w, r) return } + reader := ioutil.NopCloser(bytes.NewBuffer(body)) key = generateKeyWithBody(r.URL.String(), body) + r.Body = reader } params := r.URL.Query()