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

Leading ? is not being removed #253

Closed
ryan-rushton opened this issue Mar 31, 2020 · 3 comments
Closed

Leading ? is not being removed #253

ryan-rushton opened this issue Mar 31, 2020 · 3 comments

Comments

@ryan-rushton
Copy link

When using query string to parse

http://localhost:3000/redirect?code=2a4817a4b06d03059873

The leading string is not being removed.

The code I am using is the following,

const { location } = window;
console.log(location.search);
const parsed = parse(location.search);
console.log(parsed);

which results in

?code=2a4817a4b06d03059873
{?code: "2a4817a4b06d03059873"}

I am using version 6.11.1.

@jfmoy
Copy link

jfmoy commented Mar 31, 2020

You should check that you are importing query-string and not querystring.

@sindresorhus
Copy link
Owner

test('query strings starting with a `?`', t => {
t.deepEqual(queryString.parse('?foo=bar'), {foo: 'bar'});
});

@ryan-rushton
Copy link
Author

Ah yes that is most likely the issue. I didn’t realise querystring was even a thing. Thanks @jfmoy

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

No branches or pull requests

3 participants