diff --git a/package.json b/package.json index 7d78ba4..6726127 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "tap": "^16.3.7", "tsd": "^0.30.0", "typescript": "^5.1.6", - "undici": "^5.28.3" + "undici": "^6.10.2" }, "scripts": { "coverage": "npm run test:unit -- --coverage-report=html", diff --git a/test/issue-288.test.js b/test/issue-288.test.js index 79f3d8f..1ad5d60 100644 --- a/test/issue-288.test.js +++ b/test/issue-288.test.js @@ -3,7 +3,7 @@ const { test } = require('tap') const Fastify = require('fastify') const fastifyCompress = require('..') -const { fetch, setGlobalDispatcher, Agent } = require('undici') +const { request, setGlobalDispatcher, Agent } = require('undici') setGlobalDispatcher(new Agent({ keepAliveTimeout: 10, @@ -37,10 +37,10 @@ test('should not corrupt the file content', async (t) => { const address = await fastify.listen({ port: 0, host: '127.0.0.1' }) - const response1 = await fetch(`${address}/compress`) - const response2 = await fetch(`${address}/no-compress`) - const body1 = await response1.text() - const body2 = await response2.text() + const response1 = await request(`${address}/compress`) + const response2 = await request(`${address}/no-compress`) + const body1 = await response1.body.text() + const body2 = await response2.body.text() t.equal(body1, body2) t.equal(body1.length, twoByteUnicodeContent.length) t.equal(body2.length, twoByteUnicodeContent.length)