Skip to content

Commit 5b92da1

Browse files
author
Aaron Fullerton
committed
Added a check for booleans http::formatValue
1 parent f0f3b0b commit 5b92da1

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
@@ -148,7 +148,8 @@ function formatValue({value, collectionFormat, allowEmptyValue}, skipEncoding) {
148148
if (typeof value === 'undefined' && allowEmptyValue) {
149149
return ''
150150
}
151-
if (isFile(value)) {
151+
152+
if (isFile(value) || typeof value === 'boolean') {
152153
return value
153154
}
154155

test/http.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,14 @@ describe('http', () => {
208208
},
209209
two: {
210210
value: 2
211+
},
212+
three: {
213+
value: false
211214
}
212215
}
213216
}
214217

215-
expect(encodeFormOrQuery(req.query)).toEqual('one=1&two=2')
218+
expect(encodeFormOrQuery(req.query)).toEqual('one=1&two=2&three=false')
216219
})
217220

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

0 commit comments

Comments
 (0)