From 8b525b1aa5d384ef25370b4149f4cf2db25d399b Mon Sep 17 00:00:00 2001 From: astaxie Date: Fri, 19 Aug 2016 00:31:46 +0800 Subject: [PATCH] fix #1656 --- context/input.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/context/input.go b/context/input.go index 1e051784..fd47c36f 100644 --- a/context/input.go +++ b/context/input.go @@ -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()