Skip to content

Commit a764b09

Browse files
author
mohamed.gad
committed
fix(query): Fix query props should be casted into string (fix vuejs#2131)
1 parent bee5d73 commit a764b09

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: src/util/query.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function resolveQuery (
2929
parsedQuery = {}
3030
}
3131
for (const key in extraQuery) {
32-
parsedQuery[key] = extraQuery[key]
32+
parsedQuery[key] = extraQuery[key].toString()
3333
}
3434
return parsedQuery
3535
}

Diff for: test/unit/specs/query.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ describe('Query utils', () => {
1919
arr: ['1', null, '2']
2020
})
2121
})
22+
23+
it('should cast query props into string', () => {
24+
const query = resolveQuery('foo=bar&foo=k', { baz: 1 })
25+
expect(typeof query.baz).toBe('string')
26+
})
2227
})
2328

2429
describe('stringifyQuery', () => {

0 commit comments

Comments
 (0)