Skip to content

Commit

Permalink
Replace request with fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleyxu2005 committed Mar 30, 2024
1 parent ffe60f6 commit c1882b9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/issue-288.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { test } = require('tap')
const Fastify = require('fastify')
const fastifyCompress = require('..')
const { request, setGlobalDispatcher, Agent } = require('undici')
const { fetch, setGlobalDispatcher, Agent } = require('undici')

setGlobalDispatcher(new Agent({
keepAliveTimeout: 10,
Expand Down Expand Up @@ -37,11 +37,11 @@ test('should not corrupt the file content', async (t) => {

const address = await fastify.listen({ port: 0, host: '127.0.0.1' })

const response = await request(`${address}/compress`)
const response2 = await request(`${address}/no-compress`)
const body = await response.body.text()
const body2 = await response2.body.text()
t.equal(body.length, twoByteUnicodeContent.length)
const response1 = await fetch(`${address}/compress`)
const response2 = await fetch(`${address}/no-compress`)
const body1 = await response1.text()
const body2 = await response2.text()
t.equal(body1, body2)
t.equal(body1.length, twoByteUnicodeContent.length)
t.equal(body2.length, twoByteUnicodeContent.length)
t.equal(body, body2)
})

0 comments on commit c1882b9

Please sign in to comment.