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

fix(query): Fix query props should be casted into string (fix #2131) #3232

Merged
merged 3 commits into from Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/util/query.js
Expand Up @@ -29,7 +29,7 @@ export function resolveQuery (
parsedQuery = {}
}
for (const key in extraQuery) {
parsedQuery[key] = extraQuery[key]
parsedQuery[key] = extraQuery[key].toString()
posva marked this conversation as resolved.
Show resolved Hide resolved
}
return parsedQuery
}
Expand Down
5 changes: 5 additions & 0 deletions test/unit/specs/query.spec.js
Expand Up @@ -19,6 +19,11 @@ describe('Query utils', () => {
arr: ['1', null, '2']
})
})

it('should cast query props into string', () => {
posva marked this conversation as resolved.
Show resolved Hide resolved
const query = resolveQuery('foo=bar&foo=k', { baz: 1 })
expect(typeof query.baz).toBe('string')
posva marked this conversation as resolved.
Show resolved Hide resolved
})
posva marked this conversation as resolved.
Show resolved Hide resolved
})

describe('stringifyQuery', () => {
Expand Down