Skip to content

Commit d207d51

Browse files
authored
Merge branch 'v3' into depedencies
2 parents 03c60bb + 690fc51 commit d207d51

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

lib/read-body.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { promisify } from 'node:util'
44

55
import Busboy from '@fastify/busboy'
66
import { createWriteStream } from 'fs-temp'
7-
import hasOwnProperty from 'has-own-property'
87
import _onFinished from 'on-finished'
98
import FileType from 'stream-file-type'
109

@@ -29,7 +28,7 @@ function collectFields (busboy, limits) {
2928
if (valueTruncated) return reject(new MulterError('LIMIT_FIELD_VALUE', fieldname))
3029

3130
// Work around bug in Busboy (https://github.com/mscdex/busboy/issues/6)
32-
if (limits && hasOwnProperty(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) {
31+
if (limits && Object.hasOwn(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) {
3332
return reject(new MulterError('LIMIT_FIELD_KEY'))
3433
}
3534

@@ -54,7 +53,7 @@ function collectFiles (busboy, limits, fileFilter) {
5453
})
5554

5655
// Work around bug in Busboy (https://github.com/mscdex/busboy/issues/6)
57-
if (limits && hasOwnProperty(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) {
56+
if (limits && Object.hasOwn(limits, 'fieldNameSize') && fieldname.length > limits.fieldNameSize) {
5857
return reject(new MulterError('LIMIT_FIELD_KEY'))
5958
}
6059

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"append-field": "^2.0.0",
2626
"bytes": "^3.1.0",
2727
"fs-temp": "^2.0.1",
28-
"has-own-property": "^2.0.0",
2928
"on-finished": "^2.4.1",
3029
"stream-file-type": "^0.6.1",
3130
"type-is": "^2.0.1"
@@ -50,6 +49,6 @@
5049
"lib/"
5150
],
5251
"scripts": {
53-
"test": "standard && c8 --check-coverage --statements 100 mocha"
52+
"test": "standard && c8 --check-coverage --statements 100 mocha --exit"
5453
}
5554
}

test/body.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import stream from 'node:stream'
55
import { promisify } from 'node:util'
66

77
import FormData from 'form-data'
8-
import hasOwnProperty from 'has-own-property'
98
import recursiveNullify from 'recursive-nullify'
109
import testData from 'testdata-w3c-json-form'
1110

@@ -72,8 +71,8 @@ describe('body', () => {
7271

7372
await promisify(parser)(req, null)
7473

75-
assert.strictEqual(hasOwnProperty(req, 'body'), false)
76-
assert.strictEqual(hasOwnProperty(req, 'files'), false)
74+
assert.strictEqual(Object.hasOwn(req, 'body'), false)
75+
assert.strictEqual(Object.hasOwn(req, 'files'), false)
7776
})
7877

7978
it('should not process non-multipart GET request', async () => {
@@ -88,8 +87,8 @@ describe('body', () => {
8887

8988
await promisify(parser)(req, null)
9089

91-
assert.strictEqual(hasOwnProperty(req, 'body'), false)
92-
assert.strictEqual(hasOwnProperty(req, 'files'), false)
90+
assert.strictEqual(Object.hasOwn(req, 'body'), false)
91+
assert.strictEqual(Object.hasOwn(req, 'files'), false)
9392
})
9493

9594
for (const test of testData) {

0 commit comments

Comments
 (0)