Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/types/urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function createQueryParser (options) {
}

if (isFinite(parameterLimit)) {
parameterLimit = parameterLimit | 0
parameterLimit = Math.trunc(parameterLimit)
}

return function parse (body, encoding) {
Expand Down
16 changes: 16 additions & 0 deletions test/urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,14 @@ describe('bodyParser.urlencoded()', function () {
.expect(200, done)
})

it('should work with limit greater than 32-bit signed integer', function (done) {
request(createServer({ extended: false, parameterLimit: 3000000000 }))
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
.send('user=tobi')
.expect(200, '{"user":"tobi"}', done)
})

it('should work with Infinity limit', function (done) {
request(createServer({ extended: false, parameterLimit: Infinity }))
.post('/')
Expand Down Expand Up @@ -572,6 +580,14 @@ describe('bodyParser.urlencoded()', function () {
.expect(200, done)
})

it('should work with limit greater than 32-bit signed integer', function (done) {
request(createServer({ extended: true, parameterLimit: 3000000000 }))
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
.send('user=tobi')
.expect(200, '{"user":"tobi"}', done)
})

it('should work with Infinity limit', function (done) {
request(createServer({ extended: true, parameterLimit: Infinity }))
.post('/')
Expand Down