echox
echox copied to clipboard
Document how to bind multiple instances of the same query param to a slice
Add documentation about how to bind multiple instances of the same query parameter to a slice. Use this UT as a reference (if it is possible make a more real example than this :wink:)
func TestBindSlices(t *testing.T) {
e := New()
req := httptest.NewRequest(GET, "/?str=foo&str=bar&str=foobar", nil)
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)
result := struct {
Str []string `query:"str"`
}{}
err := c.Bind(&result)
if assert.NoError(t, err) {
assert.Equal(t, []string{"foo", "bar", "foobar"}, result.Str)
}
}
Binding documentation is in https://github.com/labstack/echox/blob/master/website/content/guide/request.md
I can take care of this, this will be my first contribution