Skip to content
Closed
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
8 changes: 4 additions & 4 deletions test/cookie/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ test('Cookie setCookie does not throw if headers is an instance of undici owns H
})
})

test('Cookie setCookie does not throw if headers is an instance of the global Headers class', { skip: !globalThis.Headers }, () => {
test('Cookie setCookie does not throw if headers is an instance of the global Headers class', () => {
const headers = new globalThis.Headers()
setCookie(headers, {
name: 'key',
Expand Down Expand Up @@ -659,7 +659,7 @@ test('Cookie getCookies does not throw if headers is an instance of undici owns
getCookies(headers)
})

test('Cookie getCookie does not throw if headers is an instance of the global Headers class', { skip: !globalThis.Headers }, () => {
test('Cookie getCookie does not throw if headers is an instance of the global Headers class', () => {
const headers = new globalThis.Headers()
getCookies(headers)
})
Expand All @@ -682,7 +682,7 @@ test('Cookie getSetCookies does not throw if headers is an instance of undici ow
getSetCookies(headers)
})

test('Cookie setCookie does not throw if headers is an instance of the global Headers class', { skip: !globalThis.Headers }, () => {
test('Cookie setCookie does not throw if headers is an instance of the global Headers class', () => {
const headers = new globalThis.Headers({ 'set-cookie': 'Space=Cat' })
getSetCookies(headers)
})
Expand All @@ -705,7 +705,7 @@ test('Cookie deleteCookie does not throw if headers is an instance of undici own
deleteCookie(headers, 'deno')
})

test('Cookie getCookie does not throw if headers is an instance of the global Headers class', { skip: !globalThis.Headers }, () => {
test('Cookie getCookie does not throw if headers is an instance of the global Headers class', () => {
const headers = new globalThis.Headers()
deleteCookie(headers, 'deno')
})
10 changes: 5 additions & 5 deletions test/cookie/global-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ const {
} = require('../..')

describe('Using global Headers', async () => {
test('deleteCookies', { skip: !globalThis.Headers }, () => {
test('deleteCookies', () => {
const headers = new globalThis.Headers()

assert.equal(headers.get('set-cookie'), null)
deleteCookie(headers, 'undici')
assert.equal(headers.get('set-cookie'), 'undici=; Expires=Thu, 01 Jan 1970 00:00:00 GMT')
})

test('getCookies', { skip: !globalThis.Headers }, () => {
test('getCookies', () => {
const headers = new globalThis.Headers({
cookie: 'get=cookies; and=attributes'
})

assert.deepEqual(getCookies(headers), { get: 'cookies', and: 'attributes' })
})

test('getSetCookies', { skip: !globalThis.Headers }, () => {
test('getSetCookies', () => {
const headers = new globalThis.Headers({
'set-cookie': 'undici=getSetCookies; Secure'
})
Expand All @@ -46,15 +46,15 @@ describe('Using global Headers', async () => {
}
})

test('setCookie', { skip: !globalThis.Headers }, () => {
test('setCookie', () => {
const headers = new globalThis.Headers()

setCookie(headers, { name: 'undici', value: 'setCookie' })
assert.equal(headers.get('Set-Cookie'), 'undici=setCookie')
})
})

describe('Headers check is not too lax', { skip: !globalThis.Headers }, () => {
describe('Headers check is not too lax', () => {
class Headers { }
Object.defineProperty(globalThis.Headers.prototype, Symbol.toStringTag, {
value: 'Headers',
Expand Down
2 changes: 1 addition & 1 deletion test/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ describe('DispatchOptions#reset', () => {
})

describe('Should include headers from iterable objects', scope => {
test('Should include headers built with Headers global object', { skip: !globalThis.Headers }, async t => {
test('Should include headers built with Headers global object', async t => {
t = tspl(t, { plan: 3 })

const server = createServer({ joinDuplicateHeaders: true }, (req, res) => {
Expand Down
Loading