diff --git a/lib/request.js b/lib/request.js index 224cedb..0da5468 100644 --- a/lib/request.js +++ b/lib/request.js @@ -304,10 +304,11 @@ function serverAddress (app, path) { * @api private */ -function TestAgent(app) { +function TestAgent(app, options={}) { if (!(this instanceof TestAgent)) return new TestAgent(app); if (typeof app === 'function') app = http.createServer(app); - (Agent || Request).call(this); + const agent = new Agent(options); + Object.assign(this, agent); this.app = app; if (typeof app !== 'string' && app && app.listen && app.address && !app.address()) { this.app = app.listen(0) diff --git a/package-lock.json b/package-lock.json index 013f1b7..29fdb8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "is-ip": "^3.1.0", "methods": "^1.1.2", "qs": "^6.11.2", - "superagent": "^8.0.9" + "superagent": "^9" }, "devDependencies": { "@jsdevtools/simplifyify": "^8.0.4", @@ -4284,14 +4284,13 @@ } }, "node_modules/formidable": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz", - "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", + "integrity": "sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==", "dependencies": { "dezalgo": "^1.0.4", "hexoid": "^1.0.0", - "once": "^1.4.0", - "qs": "^6.11.0" + "once": "^1.4.0" }, "funding": { "url": "https://ko-fi.com/tunnckoCore/commissions" @@ -13746,23 +13745,23 @@ } }, "node_modules/superagent": { - "version": "8.0.9", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-8.0.9.tgz", - "integrity": "sha512-4C7Bh5pyHTvU33KpZgwrNKh/VQnvgtCSqPRfJAUdmrtSYePVzVg4E4OzsrbkhJj9O7SO6Bnv75K/F8XVZT8YHA==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-9.0.1.tgz", + "integrity": "sha512-CcRSdb/P2oUVaEpQ87w9Obsl+E9FruRd6b2b7LdiBtJoyMr2DQt7a89anAfiX/EL59j9b2CbRFvf2S91DhuCww==", "dependencies": { "component-emitter": "^1.3.0", "cookiejar": "^2.1.4", "debug": "^4.3.4", "fast-safe-stringify": "^2.1.1", "form-data": "^4.0.0", - "formidable": "^2.1.2", + "formidable": "^3.5.1", "methods": "^1.1.2", "mime": "2.6.0", "qs": "^6.11.0", "semver": "^7.3.8" }, "engines": { - "node": ">=6.4.0 <13 || >=14" + "node": ">=14.18.0" } }, "node_modules/superagent/node_modules/form-data": { diff --git a/package.json b/package.json index 52a9aa0..6415cac 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "is-ip": "^3.1.0", "methods": "^1.1.2", "qs": "^6.11.2", - "superagent": "^8.0.9" + "superagent": "^9" }, "devDependencies": { "@jsdevtools/simplifyify": "^8.0.4",