summaryrefslogtreecommitdiff
path: root/vendor/github.com/gin-gonic/gin/binding/protobuf.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gin-gonic/gin/binding/protobuf.go')
-rw-r--r--vendor/github.com/gin-gonic/gin/binding/protobuf.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/vendor/github.com/gin-gonic/gin/binding/protobuf.go b/vendor/github.com/gin-gonic/gin/binding/protobuf.go
index a4e471535..f9ece928d 100644
--- a/vendor/github.com/gin-gonic/gin/binding/protobuf.go
+++ b/vendor/github.com/gin-gonic/gin/binding/protobuf.go
@@ -5,11 +5,10 @@
package binding
import (
- "errors"
"io/ioutil"
"net/http"
- "google.golang.org/protobuf/proto"
+ "github.com/golang/protobuf/proto"
)
type protobufBinding struct{}
@@ -27,11 +26,7 @@ func (b protobufBinding) Bind(req *http.Request, obj interface{}) error {
}
func (protobufBinding) BindBody(body []byte, obj interface{}) error {
- msg, ok := obj.(proto.Message)
- if !ok {
- return errors.New("obj is not ProtoMessage")
- }
- if err := proto.Unmarshal(body, msg); err != nil {
+ if err := proto.Unmarshal(body, obj.(proto.Message)); err != nil {
return err
}
// Here it's same to return validate(obj), but util now we can't add