diff --git a/binding/binding.go b/binding/binding.go index ddee22e6..703a1cf8 100644 --- a/binding/binding.go +++ b/binding/binding.go @@ -32,9 +32,9 @@ type Binding interface { Bind(*http.Request, any) error } -// Body adds BindBody method to Binding. BindBody is similar with Bind, +// BindingBody adds BindBody method to Binding. BindBody is similar with Bind, // but it reads the body from supplied bytes instead of req.Body. -type Body interface { +type BindingBody interface { Binding BindBody([]byte, any) error } diff --git a/context.go b/context.go index 481020f1..0fe13331 100644 --- a/context.go +++ b/context.go @@ -716,7 +716,7 @@ func (c *Context) ShouldBindWith(obj any, b binding.Binding) error { // // NOTE: This method reads the body before binding. So you should use // ShouldBindWith for better performance if you need to call only once. -func (c *Context) ShouldBindBodyWith(obj any, bb binding.Body) (err error) { +func (c *Context) ShouldBindBodyWith(obj any, bb binding.BindingBody) (err error) { var body []byte if cb, ok := c.Get(BodyBytesKey); ok { if cbb, ok := cb.([]byte); ok { diff --git a/context_test.go b/context_test.go index 88c45bc7..fb46e679 100644 --- a/context_test.go +++ b/context_test.go @@ -1801,7 +1801,7 @@ func TestContextShouldBindBodyWith(t *testing.T) { } for _, tt := range []struct { name string - bindingA, bindingB binding.Body + bindingA, bindingB binding.BindingBody bodyA, bodyB string }{ {