Skip to content

Commit 69eace2

Browse files
committed
Fix query parameters conversion
1 parent 46242d1 commit 69eace2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ _.mixin(_inflections)
99
// '1' -> 1
1010
function toNative (value) {
1111
if (typeof value === 'string') {
12-
if (value === '' || value.trim() !== value || value[0] === '0') {
12+
if (value === ''
13+
|| value.trim() !== value
14+
|| (value.length > 1 && value[0] === '0')) {
1315
return value
1416
} else if (value === 'true' || value === 'false') {
1517
return value === 'true'

test/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('utils', function () {
3636
it('should convert string to native type', function () {
3737
// should convert
3838
assert.strictEqual(utils.toNative('1'), 1)
39+
assert.strictEqual(utils.toNative('0'), 0)
3940
assert.strictEqual(utils.toNative('true'), true)
4041
// should not convert
4142
assert.strictEqual(utils.toNative(''), '')

0 commit comments

Comments
 (0)