feat: add GetRawData func. (#857)

* feat: add GetRawData func.

* update return style

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2017-03-31 08:45:56 +08:00
committed by GitHub
parent ad2dacedd6
commit 41316b9ca9
2 changed files with 17 additions and 0 deletions

View File

@ -7,6 +7,7 @@ package gin
import (
"errors"
"io"
"io/ioutil"
"math"
"mime/multipart"
"net"
@ -445,6 +446,11 @@ func (c *Context) GetHeader(key string) string {
return c.requestHeader(key)
}
// GetRawData return stream data
func (c *Context) GetRawData() ([]byte, error) {
return ioutil.ReadAll(c.Request.Body)
}
func (c *Context) SetCookie(
name string,
value string,