Skip to content

Support Duplicate Query String Keys #46

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evanlemke
Copy link

/my-page?foo=bar&foo=bar results in an error caused by calling Object.assign(obj[key], val) on an existing string

Uncaught TypeError: Cannot assign to read only property '0' of object '[object String]'

According to RFC 3986, which defines the URI (Uniform Resource Identifier) syntax, the query component can include duplicate keys. Instead of erroring, ignore duplicates.

The query component is defined as a string of characters beginning with a ? and consisting of a series of key=value pairs, each of which is separated by an &. In the case where multiple pairs with the same key exist, the behavior is application-specific, and it's up to the server or client to define how they handle such cases.

`/my-page?foo=bar&foo=bar` results in an error caused by calling `Object.assign(obj[key], val)` on an existing string
> Uncaught TypeError: Cannot assign to read only property '0' of object '[object String]'

Instead of erroring, ignore duplicates of type `string`
@evanlemke
Copy link
Author

@PaulMaly bump

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.

2 participants