Skip to content

Commit

Permalink
✅ add limit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ctcpip committed May 24, 2024
1 parent 806a0c6 commit 97f8878
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/body-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@ describe('bodyParser()', function () {
.expect(403, '[entity.verify.failed] no leading space', done)
})
})

describe('with limit option', function () {
before(function () {
this.server = createServer({ limit: '1' })
})

it('should reject payload', function (done) {
request(this.server)
.post('/')
.set('Content-Type', 'application/json')
.send('{"user":"tobi"}')
.expect(413, '[entity.too.large] request entity too large', done)
})
})
})

function createServer (opts) {
Expand Down

0 comments on commit 97f8878

Please sign in to comment.