title: How to read request body twice in Golang middleware?
body: <p>In a middleware, I want to read request body to perform some checks. Then, the request is passed to the next middleware where the body will be read again.
  Here's what I do:</p>
  
  <pre><code>bodyBytes, _ := ioutil.ReadAll(req.Body)
  req.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
  // use bodyBytes
  // pass to next middleware
  </code></pre>
  
  <p>Now, req.Body.Close will do nothing. Will it break since the previous req.Body.Close implementation did some connection handling?</p>