Skip to content

Existing query params in URL get sorted even when sort is disabled for stringifyUrl #264

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

Closed
dpatwardhan opened this issue Jun 7, 2020 · 1 comment · Fixed by #265
Closed

Comments

@dpatwardhan
Copy link
Contributor

dpatwardhan commented Jun 7, 2020

Is the following expectation correct ?

test('stringify URL without sorting params', t => {
	t.deepEqual(queryString.stringifyUrl({
        url: 'https://foo.bar?C=3&A=1', query: {D: 4, B: 2}}, {sort: false}), 
             'https://foo.bar?C=3&A=1&D=4&B=2');
});

Currently the above test will fail because the query parameters that are already present in the URL get sorted, giving

'https://foo.bar?A=1&C=3&D=4&B=2'
@sindresorhus
Copy link
Owner

Yeah, that looks like a bug.

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

Successfully merging a pull request may close this issue.

2 participants