(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func TestBindWith(t *testing.T) { |
| 18 | w := httptest.NewRecorder() |
| 19 | c, _ := CreateTestContext(w) |
| 20 | |
| 21 | c.Request, _ = http.NewRequest(http.MethodPost, "/?foo=bar&bar=foo", bytes.NewBufferString("foo=unused")) |
| 22 | |
| 23 | var obj struct { |
| 24 | Foo string `form:"foo"` |
| 25 | Bar string `form:"bar"` |
| 26 | } |
| 27 | captureOutput(t, func() { |
| 28 | assert.NoError(t, c.BindWith(&obj, binding.Form)) |
| 29 | }) |
| 30 | assert.Equal(t, "foo", obj.Bar) |
| 31 | assert.Equal(t, "bar", obj.Foo) |
| 32 | assert.Equal(t, 0, w.Body.Len()) |
| 33 | } |
nothing calls this directly
no test coverage detected