(t *testing.T)
| 430 | } |
| 431 | |
| 432 | func TestBindingQueryStringMap(t *testing.T) { |
| 433 | b := Query |
| 434 | |
| 435 | obj := make(map[string]string) |
| 436 | req := requestWithBody(http.MethodGet, "/?foo=bar&hello=world", "") |
| 437 | err := b.Bind(req, &obj) |
| 438 | require.NoError(t, err) |
| 439 | assert.NotNil(t, obj) |
| 440 | assert.Len(t, obj, 2) |
| 441 | assert.Equal(t, "bar", obj["foo"]) |
| 442 | assert.Equal(t, "world", obj["hello"]) |
| 443 | |
| 444 | obj = make(map[string]string) |
| 445 | req = requestWithBody(http.MethodGet, "/?foo=bar&foo=2&hello=world", "") // should pick last |
| 446 | err = b.Bind(req, &obj) |
| 447 | require.NoError(t, err) |
| 448 | assert.NotNil(t, obj) |
| 449 | assert.Len(t, obj, 2) |
| 450 | assert.Equal(t, "2", obj["foo"]) |
| 451 | assert.Equal(t, "world", obj["hello"]) |
| 452 | } |
| 453 | |
| 454 | func TestBindingXML(t *testing.T) { |
| 455 | testBodyBinding(t, |
nothing calls this directly
no test coverage detected