fix: remove BindingBody change

This commit is contained in:
Kacper Bąk 2022-04-23 09:58:29 +02:00
parent d6c1821fc8
commit e13d4afc42
3 changed files with 4 additions and 4 deletions

View File

@ -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
}

View File

@ -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 {

View File

@ -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
}{
{