diff --git a/util.go b/util.go index 26131a3ff..bcf90077d 100644 --- a/util.go +++ b/util.go @@ -53,7 +53,7 @@ func FilterCustomQuery(u *nurl.URL) *nurl.URL { ux := *u vx := make(nurl.Values) for k, v := range ux.Query() { - if len(k) <= 1 || (len(k) > 1 && k[0:2] != "x-") { + if len(k) <= 1 || k[0:2] != "x-" { vx[k] = v } } diff --git a/util_test.go b/util_test.go index 1ad234473..2e8558d7a 100644 --- a/util_test.go +++ b/util_test.go @@ -21,7 +21,7 @@ func TestSuint(t *testing.T) { } func TestFilterCustomQuery(t *testing.T) { - n, err := nurl.Parse("foo://host?a=b&x-custom=foo&c=d") + n, err := nurl.Parse("foo://host?a=b&x-custom=foo&c=d&ok=y") if err != nil { t.Fatal(err) } @@ -29,4 +29,7 @@ func TestFilterCustomQuery(t *testing.T) { if nx.Get("x-custom") != "" { t.Fatalf("didn't expect x-custom") } + if nx.Get("ok") != "y" { + t.Fatalf("expected ok=y, got %v", nx.Get("ok")) + } }