Skip to content

Commit b9f9acb

Browse files
committed
1 parent db3949f commit b9f9acb

File tree

6 files changed

+42
-1
lines changed

6 files changed

+42
-1
lines changed

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ unreleased
33

44
* Prevent loss of async hooks context
55
* Prevent hanging when request already read
6+
67
78
89

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"depd": "~1.1.2",
1616
"http-errors": "1.8.1",
1717
"iconv-lite": "0.4.24",
18-
"on-finished": "~2.3.0",
18+
"on-finished": "2.4.1",
1919
"qs": "6.9.7",
2020
"raw-body": "2.5.1",
2121
"type-is": "~1.6.18"

test/json.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,16 @@ describe('bodyParser.json()', function () {
568568
.expect('x-store-foo', 'bar')
569569
.end(done)
570570
})
571+
572+
it('should presist store when limit exceeded', function (done) {
573+
request(this.server)
574+
.post('/')
575+
.set('Content-Type', 'application/json')
576+
.send('{"user":"' + Buffer.alloc(1024 * 100, '.').toString() + '"}')
577+
.expect(413)
578+
.expect('x-store-foo', 'bar')
579+
.end(done)
580+
})
571581
})
572582

573583
describe('charset', function () {

test/raw.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,16 @@ describe('bodyParser.raw()', function () {
384384
test.expect('x-store-foo', 'bar')
385385
test.end(done)
386386
})
387+
388+
it('should presist store when limit exceeded', function (done) {
389+
request(this.server)
390+
.post('/')
391+
.set('Content-Type', 'application/octet-stream')
392+
.send('the user is ' + Buffer.alloc(1024 * 100, '.').toString())
393+
.expect(413)
394+
.expect('x-store-foo', 'bar')
395+
.end(done)
396+
})
387397
})
388398

389399
describe('charset', function () {

test/text.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,16 @@ describe('bodyParser.text()', function () {
423423
test.expect('x-store-foo', 'bar')
424424
test.end(done)
425425
})
426+
427+
it('should presist store when limit exceeded', function (done) {
428+
request(this.server)
429+
.post('/')
430+
.set('Content-Type', 'text/plain')
431+
.send('user is ' + Buffer.alloc(1024 * 100, '.').toString())
432+
.expect(413)
433+
.expect('x-store-foo', 'bar')
434+
.end(done)
435+
})
426436
})
427437

428438
describe('charset', function () {

test/urlencoded.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,16 @@ describe('bodyParser.urlencoded()', function () {
670670
test.expect('x-store-foo', 'bar')
671671
test.end(done)
672672
})
673+
674+
it('should presist store when limit exceeded', function (done) {
675+
request(this.server)
676+
.post('/')
677+
.set('Content-Type', 'application/x-www-form-urlencoded')
678+
.send('user=' + Buffer.alloc(1024 * 100, '.').toString())
679+
.expect(413)
680+
.expect('x-store-foo', 'bar')
681+
.end(done)
682+
})
673683
})
674684

675685
describe('charset', function () {

0 commit comments

Comments
 (0)