Skip to content
Myr

Revert "fix(uri): query binding bug (#3236)" (#3899)

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

This reverts commit 8790d08909fc4d193c6c787c9c72f3089168f411.

authored by Bo-Yi Wu · committed by GitHub · parent 8790d08 · Browse files · 2 files+2 added−25 removed
This commit

State

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

Diff stats

2 files+2 added−25 removed

  • other:+2 added−25 removed

2 files+2 added−25 removed

deleted:binding/query_test.go-23 removed
1package binding23import (4 "net/http"5 "net/url"6 "testing"78 "github.com/stretchr/testify/assert"9 "github.com/stretchr/testify/require"10)1112func TestQueryBinding(t *testing.T) {13 var s struct {14 Foo string `query:"foo"`15 }1617 request := &http.Request{URL: &url.URL{RawQuery: "foo=BAR"}}1819 err := queryBinding{}.Bind(request, &s)20 require.NoError(t, err)2122 assert.Equal(t, "BAR", s.Foo)23}
modified:binding/query.go+2 added-2 removed
10 unmodified lines
11func (queryBinding) Name() string {12 return "query"13}1415func (q queryBinding) Bind(req *http.Request, obj any) error {15func (queryBinding) Bind(req *http.Request, obj any) error {16 values := req.URL.Query()17 if err := mapFormByTag(obj, values, q.Name()); err != nil {17 if err := mapForm(obj, values); err != nil {18 return err19 }20 return validate(obj)21}