Merge branch 'new-binding-validator' of https://github.com/zhing/gin into zhing-new-binding-validator
Conflicts: binding/binding.go binding/binding_test.go
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/x-protobuf"
|
||||
)
|
||||
|
||||
type Binding interface {
|
||||
@ -38,6 +39,7 @@ var (
|
||||
Form = formBinding{}
|
||||
FormPost = formPostBinding{}
|
||||
FormMultipart = formMultipartBinding{}
|
||||
ProtoBuf = protobufBinding{}
|
||||
)
|
||||
|
||||
func Default(method, contentType string) Binding {
|
||||
@ -49,6 +51,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