Skip to content

Conversation

@snewcomer
Copy link
Contributor

@snewcomer snewcomer changed the title Generate url with nested query params [bug] Generate url with nested query params Nov 9, 2021
@kategengler
Copy link
Member

Is this still relevant? It is a draft PR

return this.visit('/').then(() => {
let expectedURL = this.routerService.urlFor('parent.child', queryParams);

assert.equal('/child?filter=[user][name][$contains]=foo', expectedURL);
Copy link
Contributor

@sukima sukima Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: This looks off. are we sure this is encoded correctly?

Per RFC3986:

If data for a URI component would conflict with a reserved character's purpose as a delimiter, then the conflicting data must be percent-encoded before the URI is formed.

And states that = is indeed a reserved character as a sub-delim. I'm a little confused how to parse this. Is filter the key to the key/value pair or is [user][name][$contains] or filter=[user][name][$contains] the key?

suggestion: per this SO answer a convention might be: ?filter[user][name][$contains]=foo instead.

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.

3 participants