Skip to content

Commit

Permalink
fix(query): Fix query props should be casted into string (fix vuejs#2131
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mohamed.gad committed Jun 14, 2020
1 parent bee5d73 commit a764b09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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()
}
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', () => {
const query = resolveQuery('foo=bar&foo=k', { baz: 1 })
expect(typeof query.baz).toBe('string')
})
})

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

0 comments on commit a764b09

Please sign in to comment.