Skip to content

Fix duplication when adding the same query key multiple times#7

Open
sleeyax wants to merge 1 commit intoRambIing:mainfrom
sleeyax:fix/multikey
Open

Fix duplication when adding the same query key multiple times#7
sleeyax wants to merge 1 commit intoRambIing:mainfrom
sleeyax:fix/multikey

Conversation

@sleeyax
Copy link
Contributor

@sleeyax sleeyax commented Oct 29, 2024

Currently, the EncodeWithOrder method duplicates the resulting query parameters when the same key was added multiple times:

values := Values{}
values.Add("xyz", "abc")
values.Add("abc", "xyz")
values.Add("foo", "bar")
values.Add("foo", "baa")
values.Add("foo", "baz") 
encoded := values.EncodeWithOrder()
// encoded:
// xyz=abc&abc=xyz&foo=bar&foo=baa&foo=baz&foo=bar&foo=baa&foo=baz&foo=bar&foo=baa&foo=baz
// 
// the expected value is:
// xyz=abc&abc=xyz&foo=bar&foo=baa&foo=baz

This PR resolves the issue.


See changed tests for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant