use errors.New to replace fmt.Errorf will much better (#2707)
This commit is contained in:
parent
c0418c48e4
commit
215c9ce231
@ -6,7 +6,7 @@ package binding
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
@ -32,7 +32,7 @@ func (jsonBinding) Name() string {
|
||||
|
||||
func (jsonBinding) Bind(req *http.Request, obj interface{}) error {
|
||||
if req == nil || req.Body == nil {
|
||||
return fmt.Errorf("invalid request")
|
||||
return errors.New("invalid request")
|
||||
}
|
||||
return decodeJSON(req.Body, obj)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user