Skip to content

Commit

Permalink
Fix to use BindBodyBytesKey for key
Browse files Browse the repository at this point in the history
  • Loading branch information
delphinus committed May 3, 2018
1 parent 1e0e4a8 commit 2c82901
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
MIMEPlain = binding.MIMEPlain
MIMEPOSTForm = binding.MIMEPOSTForm
MIMEMultipartPOSTForm = binding.MIMEMultipartPOSTForm
BodyBytesKey = "github.com/gin-gonic/gin/bodyBytes"
BindBodyBytesKey = "github.com/gin-gonic/gin/bindBodyBytes"
)

const abortIndex int8 = math.MaxInt8 / 2
Expand Down Expand Up @@ -518,7 +518,7 @@ func (c *Context) ShouldBindBodyWith(
obj interface{}, bb binding.BindingBody,
) (err error) {
var body []byte
if cb, ok := c.Get(BodyBytesKey); ok {
if cb, ok := c.Get(BindBodyBytesKey); ok {
if cbb, ok := cb.([]byte); ok {
body = cbb
}
Expand All @@ -528,7 +528,7 @@ func (c *Context) ShouldBindBodyWith(
if err != nil {
return err
}
c.Set(BodyBytesKey, body)
c.Set(BindBodyBytesKey, body)
}
return bb.BindBody(body, obj)
}
Expand Down

0 comments on commit 2c82901

Please sign in to comment.