This commit is contained in:
astaxie 2016-08-19 00:31:46 +08:00
parent 86b3162aff
commit 8b525b1aa5
1 changed files with 3 additions and 0 deletions

View File

@ -344,6 +344,9 @@ func (input *BeegoInput) Session(key interface{}) interface{} {
// CopyBody returns the raw request body data as bytes.
func (input *BeegoInput) CopyBody(MaxMemory int64) []byte {
if input.Context.Request.Body == nil {
return []byte{}
}
safe := &io.LimitedReader{R: input.Context.Request.Body, N: MaxMemory}
requestbody, _ := ioutil.ReadAll(safe)
input.Context.Request.Body.Close()