mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 19:00:54 +00:00
fix #1656
This commit is contained in:
parent
86b3162aff
commit
8b525b1aa5
@ -344,6 +344,9 @@ func (input *BeegoInput) Session(key interface{}) interface{} {
|
|||||||
|
|
||||||
// CopyBody returns the raw request body data as bytes.
|
// CopyBody returns the raw request body data as bytes.
|
||||||
func (input *BeegoInput) CopyBody(MaxMemory int64) []byte {
|
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}
|
safe := &io.LimitedReader{R: input.Context.Request.Body, N: MaxMemory}
|
||||||
requestbody, _ := ioutil.ReadAll(safe)
|
requestbody, _ := ioutil.ReadAll(safe)
|
||||||
input.Context.Request.Body.Close()
|
input.Context.Request.Body.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user