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

fix: webidl.brandcheck non strict should throw #2683

Merged
merged 7 commits into from
Feb 5, 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
34 changes: 34 additions & 0 deletions test/cookie/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,3 +599,37 @@ test('Set-Cookie parser', () => {
headers = new Headers()
assert.deepEqual(getSetCookies(headers), [])
})

test('Cookie setCookie throws if headers is not of type Headers', () => {
class Headers {
[Symbol.toStringTag] = 'CustomHeaders'
}
const headers = new Headers()
assert.throws(
() => {
setCookie(headers, {
name: 'key',
value: 'Cat',
httpOnly: true,
secure: true,
maxAge: 3
})
},
new TypeError('Illegal invocation')
)
})

test('Cookie setCookie does not throw if headers is an instance of a custom Headers class', () => {
class Headers {
[Symbol.toStringTag] = 'Headers'
append () { }
}
const headers = new Headers()
Uzlopak marked this conversation as resolved.
Show resolved Hide resolved
setCookie(headers, {
name: 'key',
value: 'Cat',
httpOnly: true,
secure: true,
maxAge: 3
})
})
Loading