diff --git a/package.json b/package.json index f2c72ca51..c40159217 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "devDependencies": { "abort-controller": "^3.0.0", "abortcontroller-polyfill": "^1.7.1", - "busboy": "^0.3.1", + "busboy": "^1.4.0", "c8": "^7.7.2", "chai": "^4.3.4", "chai-as-promised": "^7.1.1", diff --git a/test/utils/server.js b/test/utils/server.js index f01d15b78..0664cbcc9 100644 --- a/test/utils/server.js +++ b/test/utils/server.js @@ -1,7 +1,7 @@ import http from 'node:http'; import zlib from 'node:zlib'; import {once} from 'node:events'; -import Busboy from 'busboy'; +import busboy from 'busboy'; export default class TestServer { constructor(hostname) { @@ -458,21 +458,20 @@ export default class TestServer { } if (p === '/multipart') { + let body = ''; res.statusCode = 200; res.setHeader('Content-Type', 'application/json'); - const busboy = new Busboy({headers: request.headers}); - let body = ''; - busboy.on('file', async (fieldName, file, fileName) => { - body += `${fieldName}=${fileName}`; + const bb = busboy({headers: request.headers}); + bb.on('file', async (fieldName, file, info) => { + body += `${fieldName}=${info.filename}`; // consume file data // eslint-disable-next-line no-empty, no-unused-vars for await (const c of file) {} }); - - busboy.on('field', (fieldName, value) => { + bb.on('field', (fieldName, value) => { body += `${fieldName}=${value}`; }); - busboy.on('finish', () => { + bb.on('close', () => { res.end(JSON.stringify({ method: request.method, url: request.url, @@ -480,7 +479,7 @@ export default class TestServer { body })); }); - request.pipe(busboy); + request.pipe(bb); } if (p === '/m%C3%B6bius') {