(t *testing.T)
| 2252 | } |
| 2253 | |
| 2254 | func TestContextBindWithYAML(t *testing.T) { |
| 2255 | w := httptest.NewRecorder() |
| 2256 | c, _ := CreateTestContext(w) |
| 2257 | |
| 2258 | c.Request, _ = http.NewRequest(http.MethodPost, "/", strings.NewReader("foo: bar\nbar: foo")) |
| 2259 | c.Request.Header.Add("Content-Type", MIMEXML) // set fake content-type |
| 2260 | |
| 2261 | var obj struct { |
| 2262 | Foo string `yaml:"foo"` |
| 2263 | Bar string `yaml:"bar"` |
| 2264 | } |
| 2265 | require.NoError(t, c.BindYAML(&obj)) |
| 2266 | assert.Equal(t, "foo", obj.Bar) |
| 2267 | assert.Equal(t, "bar", obj.Foo) |
| 2268 | assert.Equal(t, 0, w.Body.Len()) |
| 2269 | } |
| 2270 | |
| 2271 | func TestContextBindWithTOML(t *testing.T) { |
| 2272 | w := httptest.NewRecorder() |
nothing calls this directly
no test coverage detected