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: 0 additions & 2 deletions .eslintignore

This file was deleted.

12 changes: 0 additions & 12 deletions .eslintrc.yml

This file was deleted.

3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import neostandard from 'neostandard'

export default [...neostandard({ ignores: ['coverage'] })]
6 changes: 3 additions & 3 deletions lib/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function read (req, res, next, parse, debug, options) {
verify(req, res, body, encoding)
} catch (err) {
next(createError(403, err, {
body: body,
body,
type: err.type || 'entity.verify.failed'
}))
return
Expand Down Expand Up @@ -188,7 +188,7 @@ function contentstream (req, debug, inflate) {

if (inflate === false && encoding !== 'identity') {
throw createError(415, 'content encoding unsupported', {
encoding: encoding,
encoding,
type: 'encoding.unsupported'
})
}
Expand Down Expand Up @@ -223,7 +223,7 @@ function createDecompressionStream (encoding, debug) {
return zlib.createBrotliDecompress()
default:
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
encoding: encoding,
encoding,
type: 'encoding.unsupported'
})
}
Expand Down
10 changes: 5 additions & 5 deletions lib/types/urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ function createQueryParser (options) {
try {
return qs.parse(body, {
allowPrototypes: true,
arrayLimit: arrayLimit,
depth: depth,
charsetSentinel: charsetSentinel,
interpretNumericEntities: interpretNumericEntities,
arrayLimit,
depth,
charsetSentinel,
interpretNumericEntities,
charset: encoding,
parameterLimit: parameterLimit,
parameterLimit,
strictDepth: true
})
} catch (err) {
Expand Down
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,9 @@
"type-is": "^2.1.0"
},
"devDependencies": {
"eslint": "^8.57.1",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-markdown": "^3.0.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-standard": "^4.1.0",
"eslint": "^9.39.5",
"mocha": "^11.7.6",
"neostandard": "^0.13.0",
"nyc": "^17.1.0",
"supertest": "^7.2.2"
},
Expand Down
1 change: 1 addition & 0 deletions test/body-parser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { describe, it } = require('mocha')
const assert = require('node:assert')

const bodyParser = require('..')
Expand Down
1 change: 1 addition & 0 deletions test/json.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { describe, it, before } = require('mocha')
const assert = require('node:assert')
const AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage
const http = require('node:http')
Expand Down
1 change: 1 addition & 0 deletions test/raw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { describe, it, before } = require('mocha')
const assert = require('node:assert')
const AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage
const http = require('node:http')
Expand Down
1 change: 1 addition & 0 deletions test/text.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { describe, it, before } = require('mocha')
const assert = require('node:assert')
const AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage
const http = require('node:http')
Expand Down
15 changes: 8 additions & 7 deletions test/urlencoded.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { describe, it, before } = require('mocha')
const assert = require('node:assert')
const AsyncLocalStorage = require('node:async_hooks').AsyncLocalStorage
const http = require('node:http')
Expand Down Expand Up @@ -51,7 +52,7 @@ describe('bodyParser.urlencoded()', function () {
extendedValues.forEach(function (extended) {
describe('in ' + (extended ? 'extended' : 'simple') + ' mode', function () {
it('should parse x-www-form-urlencoded with an explicit iso-8859-1 encoding', function (done) {
const server = createServer({ extended: extended })
const server = createServer({ extended })
request(server)
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded; charset=iso-8859-1')
Expand All @@ -60,7 +61,7 @@ describe('bodyParser.urlencoded()', function () {
})

it('should parse x-www-form-urlencoded with unspecified iso-8859-1 encoding when the defaultCharset is set to iso-8859-1', function (done) {
const server = createServer({ defaultCharset: 'iso-8859-1', extended: extended })
const server = createServer({ defaultCharset: 'iso-8859-1', extended })
request(server)
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
Expand All @@ -69,7 +70,7 @@ describe('bodyParser.urlencoded()', function () {
})

it('should parse x-www-form-urlencoded with an unspecified iso-8859-1 encoding when the utf8 sentinel has a value of %26%2310003%3B', function (done) {
const server = createServer({ charsetSentinel: true, extended: extended })
const server = createServer({ charsetSentinel: true, extended })
request(server)
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
Expand All @@ -78,7 +79,7 @@ describe('bodyParser.urlencoded()', function () {
})

it('should parse x-www-form-urlencoded with an unspecified utf-8 encoding when the utf8 sentinel has a value of %E2%9C%93 and the defaultCharset is iso-8859-1', function (done) {
const server = createServer({ charsetSentinel: true, extended: extended })
const server = createServer({ charsetSentinel: true, extended })
request(server)
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
Expand All @@ -87,7 +88,7 @@ describe('bodyParser.urlencoded()', function () {
})

it('should not leave an empty string parameter when removing the utf8 sentinel from the start of the string', function (done) {
const server = createServer({ charsetSentinel: true, extended: extended })
const server = createServer({ charsetSentinel: true, extended })
request(server)
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
Expand All @@ -96,7 +97,7 @@ describe('bodyParser.urlencoded()', function () {
})

it('should not leave an empty string parameter when removing the utf8 sentinel from the middle of the string', function (done) {
const server = createServer({ charsetSentinel: true, extended: extended })
const server = createServer({ charsetSentinel: true, extended })
request(server)
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
Expand All @@ -105,7 +106,7 @@ describe('bodyParser.urlencoded()', function () {
})

it('should not leave an empty string parameter when removing the utf8 sentinel from the end of the string', function (done) {
const server = createServer({ charsetSentinel: true, extended: extended })
const server = createServer({ charsetSentinel: true, extended })
request(server)
.post('/')
.set('Content-Type', 'application/x-www-form-urlencoded')
Expand Down
1 change: 1 addition & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { describe, it } = require('mocha')
const assert = require('node:assert')
const { normalizeOptions } = require('../lib/utils.js')

Expand Down