From 5b92da1c9cc984aee19a53e89ac53c2da682a107 Mon Sep 17 00:00:00 2001 From: Aaron Fullerton Date: Fri, 30 Jun 2017 11:00:54 -0600 Subject: [PATCH] Added a check for booleans http::formatValue --- src/http.js | 3 ++- test/http.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/http.js b/src/http.js index a701387dc..2da6733ea 100644 --- a/src/http.js +++ b/src/http.js @@ -148,7 +148,8 @@ function formatValue({value, collectionFormat, allowEmptyValue}, skipEncoding) { if (typeof value === 'undefined' && allowEmptyValue) { return '' } - if (isFile(value)) { + + if (isFile(value) || typeof value === 'boolean') { return value } diff --git a/test/http.js b/test/http.js index c0cebc781..54e9c6657 100644 --- a/test/http.js +++ b/test/http.js @@ -208,11 +208,14 @@ describe('http', () => { }, two: { value: 2 + }, + three: { + value: false } } } - expect(encodeFormOrQuery(req.query)).toEqual('one=1&two=2') + expect(encodeFormOrQuery(req.query)).toEqual('one=1&two=2&three=false') }) it('should handle arrays', function () {