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

Empty key triggers error in decode-uri-component #227

Closed
ianwensink opened this issue Dec 6, 2019 · 1 comment
Closed

Empty key triggers error in decode-uri-component #227

ianwensink opened this issue Dec 6, 2019 · 1 comment

Comments

@ianwensink
Copy link

When you have a query like ?foo=bar&baz, baz won't have a value.

When the values get decoded with decode-uri-component, an error will be thrown:

TypeError: Expected encodedURI to be of type string, got undefined

I think a check should be performed before decoding the value the prevent this error.

@sindresorhus
Copy link
Owner

We already have a test for this:

t.deepEqual(queryString.parse('foo=bar&key'), {
foo: 'bar',
key: null
});

Submit a pull request with a failing test and I'll take a closer look.

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

2 participants