add protobuf binding for gin
This commit is contained in:
@ -14,6 +14,7 @@ const (
|
||||
MIMEPlain = "text/plain"
|
||||
MIMEPOSTForm = "application/x-www-form-urlencoded"
|
||||
MIMEMultipartPOSTForm = "multipart/form-data"
|
||||
MIMEPROTOBUF = "application/octet-stream"
|
||||
)
|
||||
|
||||
type Binding interface {
|
||||
@ -33,9 +34,10 @@ type StructValidator interface {
|
||||
var Validator StructValidator = &defaultValidator{}
|
||||
|
||||
var (
|
||||
JSON = jsonBinding{}
|
||||
XML = xmlBinding{}
|
||||
Form = formBinding{}
|
||||
JSON = jsonBinding{}
|
||||
XML = xmlBinding{}
|
||||
Form = formBinding{}
|
||||
ProtoBuf = protobufBinding{}
|
||||
)
|
||||
|
||||
func Default(method, contentType string) Binding {
|
||||
@ -47,6 +49,8 @@ func Default(method, contentType string) Binding {
|
||||
return JSON
|
||||
case MIMEXML, MIMEXML2:
|
||||
return XML
|
||||
case MIMEPROTOBUF:
|
||||
return ProtoBuf
|
||||
default: //case MIMEPOSTForm, MIMEMultipartPOSTForm:
|
||||
return Form
|
||||
}
|
||||
|
Reference in New Issue
Block a user