mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 00:21:05 -05: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");
|
||||
|
|
|
@ -4041,25 +4041,9 @@
|
|||
"headers-record.any.worker.html": true,
|
||||
"headers-structure.any.worker.html": true,
|
||||
"header-setcookie.any.html": [
|
||||
"Headers.prototype.getSetCookie with no headers present",
|
||||
"Headers.prototype.getSetCookie with one header",
|
||||
"Headers.prototype.getSetCookie with one header created from an object",
|
||||
"Headers.prototype.getSetCookie with multiple headers",
|
||||
"Headers.prototype.getSetCookie with an empty header",
|
||||
"Headers.prototype.getSetCookie with two equal headers",
|
||||
"Headers.prototype.getSetCookie ignores set-cookie2 headers",
|
||||
"Headers.prototype.getSetCookie preserves header ordering",
|
||||
"Set-Cookie is a forbidden response header"
|
||||
],
|
||||
"header-setcookie.any.worker.html": [
|
||||
"Headers.prototype.getSetCookie with no headers present",
|
||||
"Headers.prototype.getSetCookie with one header",
|
||||
"Headers.prototype.getSetCookie with one header created from an object",
|
||||
"Headers.prototype.getSetCookie with multiple headers",
|
||||
"Headers.prototype.getSetCookie with an empty header",
|
||||
"Headers.prototype.getSetCookie with two equal headers",
|
||||
"Headers.prototype.getSetCookie ignores set-cookie2 headers",
|
||||
"Headers.prototype.getSetCookie preserves header ordering",
|
||||
"Set-Cookie is a forbidden response header"
|
||||
]
|
||||
},
|
||||
|
@ -4890,8 +4874,6 @@
|
|||
]
|
||||
},
|
||||
"idlharness.any.html": [
|
||||
"Headers interface: operation getSetCookie()",
|
||||
"Headers interface: new Headers() must inherit property \"getSetCookie()\" with the proper type",
|
||||
"Request interface: attribute destination",
|
||||
"Request interface: attribute referrer",
|
||||
"Request interface: attribute referrerPolicy",
|
||||
|
@ -4923,8 +4905,6 @@
|
|||
"Window interface: operation fetch(RequestInfo, optional RequestInit)"
|
||||
],
|
||||
"idlharness.any.worker.html": [
|
||||
"Headers interface: operation getSetCookie()",
|
||||
"Headers interface: new Headers() must inherit property \"getSetCookie()\" with the proper type",
|
||||
"Request interface: attribute destination",
|
||||
"Request interface: attribute referrer",
|
||||
"Request interface: attribute referrerPolicy",
|
||||
|
|
Loading…
Reference in a new issue