Merge branch 'multipart-form-data-fix' of https://github.com/konjoot/gin
- the merge was manually modified before committing.
This commit is contained in:
@ -42,7 +42,7 @@ func Default(method, contentType string) Binding {
|
||||
return JSON
|
||||
case MIMEXML, MIMEXML2:
|
||||
return XML
|
||||
default:
|
||||
default: //case MIMEPOSTForm, MIMEMultipartPOSTForm:
|
||||
return Form
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,10 @@ func TestBindingDefault(t *testing.T) {
|
||||
assert.Equal(t, Default("PUT", MIMEXML2), XML)
|
||||
|
||||
assert.Equal(t, Default("POST", MIMEPOSTForm), Form)
|
||||
assert.Equal(t, Default("DELETE", MIMEPOSTForm), Form)
|
||||
assert.Equal(t, Default("PUT", MIMEPOSTForm), Form)
|
||||
|
||||
assert.Equal(t, Default("POST", MIMEMultipartPOSTForm), Form)
|
||||
assert.Equal(t, Default("PUT", MIMEMultipartPOSTForm), Form)
|
||||
}
|
||||
|
||||
func TestBindingJSON(t *testing.T) {
|
||||
@ -63,7 +66,7 @@ func TestBindingXML(t *testing.T) {
|
||||
|
||||
func testFormBinding(t *testing.T, method, path, badPath, body, badBody string) {
|
||||
b := Form
|
||||
assert.Equal(t, b.Name(), "query")
|
||||
assert.Equal(t, b.Name(), "form")
|
||||
|
||||
obj := FooBarStruct{}
|
||||
req := requestWithBody(method, path, body)
|
||||
|
Reference in New Issue
Block a user