1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 17:30:56 +00:00

Merge commit 'efbde1ee77517486eac03e814e01d724ddad18e6' into develop

This commit is contained in:
tnextday 2016-08-20 11:22:17 +08:00
commit 715c2c4312
2 changed files with 5 additions and 1 deletions

View File

@ -337,13 +337,16 @@ func (input *BeegoInput) Cookie(key string) string {
} }
// Session returns current session item value by a given key. // Session returns current session item value by a given key.
// if non-existed, return empty string. // if non-existed, return nil.
func (input *BeegoInput) Session(key interface{}) interface{} { func (input *BeegoInput) Session(key interface{}) interface{} {
return input.CruSession.Get(key) return input.CruSession.Get(key)
} }
// 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()

View File

@ -117,6 +117,7 @@ type Schema struct {
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Required []string `json:"required,omitempty"` Required []string `json:"required,omitempty"`
Type string `json:"type,omitempty"` Type string `json:"type,omitempty"`
Items *Propertie `json:"items,omitempty"`
Properties map[string]Propertie `json:"properties,omitempty"` Properties map[string]Propertie `json:"properties,omitempty"`
} }