Skip to content

Commit 6756717

Browse files
authored
Merge pull request #1100 from aaronfullerton/fix-falsy-formatValue
Allow false query parameters
2 parents fa5d649 + 6d1559e commit 6756717

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/http.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ function formatValue({value, collectionFormat, allowEmptyValue}, skipEncoding) {
144144
if (typeof value === 'undefined' && allowEmptyValue) {
145145
return ''
146146
}
147-
if (isFile(value)) {
147+
148+
if (isFile(value) || typeof value === 'boolean') {
148149
return value
149150
}
150151

test/http.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,14 @@ describe('http', () => {
211211
},
212212
two: {
213213
value: 2
214+
},
215+
three: {
216+
value: false
214217
}
215218
}
216219
}
217220

218-
expect(encodeFormOrQuery(req.query)).toEqual('one=1&two=2')
221+
expect(encodeFormOrQuery(req.query)).toEqual('one=1&two=2&three=false')
219222
})
220223

221224
it('should handle arrays', function () {

0 commit comments

Comments
 (0)