File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ func FilterCustomQuery(u *nurl.URL) *nurl.URL {
5353 ux := * u
5454 vx := make (nurl.Values )
5555 for k , v := range ux .Query () {
56- if len (k ) <= 1 || ( len ( k ) > 1 && k [0 :2 ] != "x-" ) {
56+ if len (k ) <= 1 || k [0 :2 ] != "x-" {
5757 vx [k ] = v
5858 }
5959 }
Original file line number Diff line number Diff line change @@ -21,12 +21,15 @@ func TestSuint(t *testing.T) {
2121}
2222
2323func TestFilterCustomQuery (t * testing.T ) {
24- n , err := nurl .Parse ("foo://host?a=b&x-custom=foo&c=d" )
24+ n , err := nurl .Parse ("foo://host?a=b&x-custom=foo&c=d&ok=y " )
2525 if err != nil {
2626 t .Fatal (err )
2727 }
2828 nx := FilterCustomQuery (n ).Query ()
2929 if nx .Get ("x-custom" ) != "" {
3030 t .Fatalf ("didn't expect x-custom" )
3131 }
32+ if nx .Get ("ok" ) != "y" {
33+ t .Fatalf ("expected ok=y, got %v" , nx .Get ("ok" ))
34+ }
3235}
You can’t perform that action at this time.
0 commit comments