Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove test for issue 1670 #3690

Merged
merged 3 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"build:node": "npx esbuild@0.19.10 index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names && node scripts/strip-comments.js",
"build:node": "esbuild index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names && node scripts/strip-comments.js",
"prebuild:wasm": "node build/wasm.js --prebuild",
"build:wasm": "node build/wasm.js --docker",
"generate-pem": "node scripts/generate-pem.js",
Expand Down Expand Up @@ -111,6 +111,7 @@
"c8": "^10.0.0",
"cross-env": "^7.0.3",
"dns-packet": "^5.4.0",
"esbuild": "^0.19.10",
"eslint": "^9.9.0",
"fast-check": "^3.17.1",
"https-pem": "^3.0.0",
Expand Down
10 changes: 0 additions & 10 deletions test/issue-1670.js

This file was deleted.

26 changes: 18 additions & 8 deletions test/node-fetch/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const HeadersOrig = require('../../lib/web/fetch/headers.js').Headers
const ResponseOrig = require('../../lib/web/fetch/response.js').Response
const RequestOrig = require('../../lib/web/fetch/request.js').Request
const TestServer = require('./utils/server.js')
const { createServer } = require('node:http')
const { default: tspl } = require('@matteo.collina/tspl')

const {
Uint8Array: VMUint8Array
Expand Down Expand Up @@ -1617,15 +1619,23 @@ describe('node-fetch', () => {
})
})

it('should support http request', { timeout: 5000 }, function () {
const url = 'https://github.com/'
const options = {
method: 'HEAD'
}
return fetch(url, options).then(res => {
assert.strictEqual(res.status, 200)
assert.strictEqual(res.ok, true)
it('should support http request', { timeout: 5000 }, async function (t) {
t = tspl(t, { plan: 2 })
const server = createServer((req, res) => {
res.end()
})
after(() => server.close())
server.listen(0, () => {
const url = `http://localhost:${server.address().port}`
const options = {
method: 'HEAD'
}
fetch(url, options).then(res => {
t.strictEqual(res.status, 200)
t.strictEqual(res.ok, true)
})
})
await t.completed
})

it('should encode URLs as UTF-8', async () => {
Expand Down
Loading