(t *testing.T)
| 2443 | } |
| 2444 | |
| 2445 | func TestContextShouldBindWithTOML(t *testing.T) { |
| 2446 | w := httptest.NewRecorder() |
| 2447 | c, _ := CreateTestContext(w) |
| 2448 | |
| 2449 | c.Request, _ = http.NewRequest(http.MethodPost, "/", strings.NewReader("foo='bar'\nbar= 'foo'")) |
| 2450 | c.Request.Header.Add("Content-Type", MIMETOML) // set fake content-type |
| 2451 | |
| 2452 | var obj struct { |
| 2453 | Foo string `toml:"foo"` |
| 2454 | Bar string `toml:"bar"` |
| 2455 | } |
| 2456 | require.NoError(t, c.ShouldBindTOML(&obj)) |
| 2457 | assert.Equal(t, "foo", obj.Bar) |
| 2458 | assert.Equal(t, "bar", obj.Foo) |
| 2459 | assert.Equal(t, 0, w.Body.Len()) |
| 2460 | } |
| 2461 | |
| 2462 | func TestContextBadAutoShouldBind(t *testing.T) { |
| 2463 | w := httptest.NewRecorder() |
nothing calls this directly
no test coverage detected