Skip to content
Myr

chore(testing): case sensitive for query string (#1720)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

fix #1692

authored by Bo-Yi Wu · committed by GitHub · parent 8073685 · Browse files · 1 file+8 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−4 removed

  • other:+8 added−4 removed

1 file+8 added−4 removed

modified:context_test.go+8 added-4 removed
1455 unmodified lines
14561457 c.Request, _ = http.NewRequest("POST", "/", bytes.NewBufferString(`<?xml version="1.0" encoding="UTF-8"?>1458 <root>1459 <foo>FOO</foo>1460 <bar>BAR</bar>1460 <bar>BAR</bar>1461 </root>`))1462 c.Request.Header.Add("Content-Type", MIMEXML) // set fake content-type14631464 var obj struct {
9 unmodified lines
1474func TestContextShouldBindWithQuery(t *testing.T) {1475 w := httptest.NewRecorder()1476 c, _ := CreateTestContext(w)14771478 c.Request, _ = http.NewRequest("POST", "/?foo=bar&bar=foo", bytes.NewBufferString("foo=unused"))1478 c.Request, _ = http.NewRequest("POST", "/?foo=bar&bar=foo&Foo=bar1&Bar=foo1", bytes.NewBufferString("foo=unused"))14791480 var obj struct {1481 Foo string `form:"foo"`1482 Bar string `form:"bar"`1481 Foo string `form:"foo"`1482 Bar string `form:"bar"`1483 Foo1 string `form:"Foo"`1484 Bar1 string `form:"Bar"`1485 }1486 assert.NoError(t, c.ShouldBindQuery(&obj))1487 assert.Equal(t, "foo", obj.Bar)1488 assert.Equal(t, "bar", obj.Foo)1489 assert.Equal(t, "foo1", obj.Bar1)1490 assert.Equal(t, "bar1", obj.Foo1)1491 assert.Equal(t, 0, w.Body.Len())1492}14931494func TestContextShouldBindWithYAML(t *testing.T) {
245 unmodified lines