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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix another test
  • Loading branch information
Uzlopak committed Oct 6, 2024
commit d1d441f6a36d2b016a8075073e28ad3e6e49db76
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