Skip to content

Commit

Permalink
tests: add leading whitespace strict json test
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Sep 8, 2017
1 parent 1841248 commit 87df7e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ describe('bodyParser.json()', function () {
.expect(400, /unexpected token/i, done)
})

it('should not parse primitives with leading whitespaces', function (done) {
request(server)
.post('/')
.set('Content-Type', 'application/json')
.send(' true')
.expect(400, /unexpected token/i, done)
})

it('should allow leading whitespaces in JSON', function (done) {
request(server)
.post('/')
Expand Down

0 comments on commit 87df7e6

Please sign in to comment.