mirror of
https://github.com/denoland/deno.git
synced 2025-10-17 22:27:14 +00:00
feat(ext/fetch): add Headers#getSetCookie (#13542)
Spec change: https://github.com/whatwg/fetch/pull/1346 Tests: https://github.com/web-platform-tests/wpt/pull/31442 (ran against this PR and they all pass) --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
0ddfd5d52a
commit
d8e8e60f9f
2 changed files with 17 additions and 20 deletions
|
@ -308,6 +308,7 @@ class Headers {
|
|||
* @param {string} name
|
||||
*/
|
||||
delete(name) {
|
||||
webidl.assertBranded(this, HeadersPrototype);
|
||||
const prefix = "Failed to execute 'delete' on 'Headers'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
name = webidl.converters["ByteString"](name, prefix, "Argument 1");
|
||||
|
@ -333,6 +334,7 @@ class Headers {
|
|||
* @param {string} name
|
||||
*/
|
||||
get(name) {
|
||||
webidl.assertBranded(this, HeadersPrototype);
|
||||
const prefix = "Failed to execute 'get' on 'Headers'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
name = webidl.converters["ByteString"](name, prefix, "Argument 1");
|
||||
|
@ -345,10 +347,25 @@ class Headers {
|
|||
return getHeader(list, name);
|
||||
}
|
||||
|
||||
getSetCookie() {
|
||||
webidl.assertBranded(this, HeadersPrototype);
|
||||
const list = this[_headerList];
|
||||
|
||||
const entries = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (byteLowerCase(list[i][0]) === "set-cookie") {
|
||||
ArrayPrototypePush(entries, list[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
*/
|
||||
has(name) {
|
||||
webidl.assertBranded(this, HeadersPrototype);
|
||||
const prefix = "Failed to execute 'has' on 'Headers'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
name = webidl.converters["ByteString"](name, prefix, "Argument 1");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue