Commit 27d3b1c3 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Use ReadAll

parent 7f508893
......@@ -3,7 +3,6 @@ package helper
import (
"bytes"
"errors"
"io"
"io/ioutil"
"log"
"mime"
......@@ -185,13 +184,7 @@ func ReadRequestBody(w http.ResponseWriter, r *http.Request, maxBodySize int64)
limitedBody := http.MaxBytesReader(w, r.Body, maxBodySize)
defer limitedBody.Close()
var body bytes.Buffer
_, err := io.Copy(&body, limitedBody)
if err != nil {
return nil, err
}
return body.Bytes(), nil
return ioutil.ReadAll(limitedBody)
}
func CloneRequestWithNewBody(r *http.Request, body []byte) *http.Request {
......
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