Skip to content

Commit 39744cf

Browse files
authored
chore: linter (#534)
1 parent b2695c4 commit 39744cf

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

lib/types/urlencoded.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function extendedparser (options) {
147147
throw new TypeError('option parameterLimit must be a positive number')
148148
}
149149

150-
if(isNaN(depth) || depth < 0) {
150+
if (isNaN(depth) || depth < 0) {
151151
throw new TypeError('option depth must be a zero or a positive number')
152152
}
153153

test/urlencoded.js

+9-15
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,19 @@ describe('bodyParser.urlencoded()', function () {
220220
})
221221
})
222222

223-
224223
describe('with depth option', function () {
225224
describe('when custom value set', function () {
226-
227225
it('should reject non possitive numbers', function () {
228226
assert.throws(createServer.bind(null, { extended: true, depth: -1 }),
229227
/TypeError: option depth must be a zero or a positive number/)
230228
assert.throws(createServer.bind(null, { extended: true, depth: NaN }),
231229
/TypeError: option depth must be a zero or a positive number/)
232-
assert.throws(createServer.bind(null, { extended: true, depth: "beep" }),
230+
assert.throws(createServer.bind(null, { extended: true, depth: 'beep' }),
233231
/TypeError: option depth must be a zero or a positive number/)
234232
})
235233

236-
237234
it('should parse up to the specified depth', function (done) {
238-
this.server = createServer({ extended:true, depth: 10 })
235+
this.server = createServer({ extended: true, depth: 10 })
239236
request(this.server)
240237
.post('/')
241238
.set('Content-Type', 'application/x-www-form-urlencoded')
@@ -244,15 +241,14 @@ describe('bodyParser.urlencoded()', function () {
244241
})
245242

246243
it('should not parse beyond the specified depth', function (done) {
247-
this.server = createServer({ extended:true, depth: 1 })
244+
this.server = createServer({ extended: true, depth: 1 })
248245
request(this.server)
249246
.post('/')
250247
.set('Content-Type', 'application/x-www-form-urlencoded')
251248
.send('a[b][c][d][e]=value')
252249
.expect(400, '[querystring.parse.rangeError] The input exceeded the depth', done)
253250
})
254251
})
255-
256252

257253
describe('when default value', function () {
258254
before(function () {
@@ -265,7 +261,7 @@ describe('bodyParser.urlencoded()', function () {
265261
deepObject += '[p]'
266262
}
267263
deepObject += '=value'
268-
264+
269265
request(this.server)
270266
.post('/')
271267
.set('Content-Type', 'application/x-www-form-urlencoded')
@@ -281,21 +277,19 @@ describe('bodyParser.urlencoded()', function () {
281277
})
282278

283279
it('should not parse beyond the specified depth', function (done) {
284-
var deepObject = 'a';
280+
var deepObject = 'a'
285281
for (var i = 0; i < 33; i++) {
286-
deepObject += '[p]';
282+
deepObject += '[p]'
287283
}
288-
deepObject += '=value';
284+
deepObject += '=value'
289285

290286
request(this.server)
291287
.post('/')
292288
.set('Content-Type', 'application/x-www-form-urlencoded')
293289
.send(deepObject)
294-
.expect(400, '[querystring.parse.rangeError] The input exceeded the depth', done);
295-
});
296-
290+
.expect(400, '[querystring.parse.rangeError] The input exceeded the depth', done)
291+
})
297292
})
298-
299293
})
300294

301295
describe('with inflate option', function () {

0 commit comments

Comments
 (0)