Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant depth check #538

Merged
merged 1 commit into from
Sep 10, 2024
Merged
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
11 changes: 2 additions & 9 deletions lib/types/urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ function urlencoded (options) {
: opts.limit
var type = opts.type || 'application/x-www-form-urlencoded'
var verify = opts.verify || false
var depth = typeof opts.depth !== 'number'
? Number(opts.depth || 32)
: opts.depth

if (verify !== false && typeof verify !== 'function') {
throw new TypeError('option verify must be function')
Expand Down Expand Up @@ -121,8 +118,7 @@ function urlencoded (options) {
encoding: charset,
inflate: inflate,
limit: limit,
verify: verify,
depth: depth
verify: verify
})
}
}
Expand All @@ -137,10 +133,7 @@ function extendedparser (options) {
var parameterLimit = options.parameterLimit !== undefined
? options.parameterLimit
: 1000

var depth = typeof options.depth !== 'number'
? Number(options.depth || 32)
: options.depth
var depth = options.depth !== undefined ? options.depth : 32
var parse = parser('qs')

if (isNaN(parameterLimit) || parameterLimit < 1) {
Expand Down
Loading