Closed rmulley closed 11 years ago
I've just attempted to duplicate this problem in a test using the URL you provided. It does not fail for me in the test.
Can you provide a test that demonstrates the issue? Is the URL you gave the actual problem URL?
// https://github.com/stretchr/goweb/issues/46
func TestWebContextHyphenatedURLQueryParams(t *testing.T) {
responseWriter := new(http_test.TestResponseWriter)
testRequest, _ := http.NewRequest("GET", "http://localhost/api/1/company/board-members/?ids=106,104", strings.NewReader("[{\"something\":true},{\"something\":false}]"))
codecService := codecsservices.NewWebCodecService()
c := NewWebContext(responseWriter, testRequest, codecService)
params := c.QueryParams()
if assert.NotNil(t, params) {
assert.Equal(t, "106,104", params.Get("ids").([]string)[0])
}
}
@tylerb Problem appeared to be in GoWeb but was actually in a PHP class we built that was adding the '?' last second. I apologize for the inconvenience, no bug.
Making a hyphenated URL request causes the GET parameters to contain a trailing '?'.
For instance, if I make the call: http://localhost/api/1/company/board-members/?ids=106,104
I get ids = 106,104?