From 2c82901ceab6ae53730a3cfcd9839bee11a08f13 Mon Sep 17 00:00:00 2001 From: delphinus Date: Thu, 3 May 2018 16:42:10 +0900 Subject: [PATCH] Fix to use `BindBodyBytesKey` for key --- context.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/context.go b/context.go index c0f0b6b2..fc6e2399 100755 --- a/context.go +++ b/context.go @@ -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 @@ -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 } @@ -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) }