Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing deletion of headers/queryargs having multiple values. #918

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ func delAllArgs(args []argsKV, key string) []argsKV {
tmp := *kv
copy(args[i:], args[i+1:])
n--
i--
args[n] = tmp
args = args[:n]
}
Expand Down
14 changes: 14 additions & 0 deletions args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,17 @@ func testArgsParse(t *testing.T, a *Args, s string, expectedLen int, expectedArg
}
}
}

func TestArgsDeleteAll(t *testing.T) {
t.Parallel()
var a Args
a.Add("q1", "foo")
a.Add("q1", "bar")
a.Add("q1", "baz")
a.Add("q1", "quux")
a.Add("q2", "1234")
a.Del("q1")
if a.Len() != 1 || a.Has("q1") {
t.Fatalf("Expected q1 arg to be completely deleted. Current Args: %s", a.String())
}
}