Skip to content

Commit 97f8878

Browse files
committed
✅ add limit test
1 parent 806a0c6 commit 97f8878

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/body-parser.js

+14
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,20 @@ describe('bodyParser()', function () {
141141
.expect(403, '[entity.verify.failed] no leading space', done)
142142
})
143143
})
144+
145+
describe('with limit option', function () {
146+
before(function () {
147+
this.server = createServer({ limit: '1' })
148+
})
149+
150+
it('should reject payload', function (done) {
151+
request(this.server)
152+
.post('/')
153+
.set('Content-Type', 'application/json')
154+
.send('{"user":"tobi"}')
155+
.expect(413, '[entity.too.large] request entity too large', done)
156+
})
157+
})
144158
})
145159

146160
function createServer (opts) {

0 commit comments

Comments
 (0)