Commit d06c15ca authored by Carter's avatar Carter

Set the request body to a new ReadCloser

parent 59b1e8b0
package httpserver
import (
"bytes"
"io/ioutil"
"log"
"net"
......@@ -127,6 +128,9 @@ func NewReplacer(r *http.Request, rr *ResponseRecorder, emptyValue string) Repla
}
body, err := ioutil.ReadAll(r.Body)
// Create a new ReadCloser to keep the body from being drained.
r.Body = ioutil.NopCloser(bytes.NewBuffer(body))
if err != nil {
log.Printf("[WARNING] Cannot read request body %v", err)
return ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment