Skip to content

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