Implement Headers.prototype.getSetCookie

This commit is contained in:
2shiori17 2023-03-05 00:52:19 +09:00
parent 9f98a1ed1a
commit 4ee3f575f6
3 changed files with 11 additions and 36 deletions

View file

@ -155,6 +155,16 @@ impl HeadersMethods for Headers {
.map(|v| ByteString::new(v.as_bytes().to_vec())))
}
// https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
fn GetSetCookie(&self) -> Vec<ByteString> {
self.header_list
.borrow()
.get_all("Set-Cookie")
.iter()
.map(|v| ByteString::new(v.as_bytes().to_vec()))
.collect()
}
// https://fetch.spec.whatwg.org/#dom-headers-has
fn Has(&self, name: ByteString) -> Fallible<bool> {
// Step 1

View file

@ -15,6 +15,7 @@ interface Headers {
undefined delete(ByteString name);
[Throws]
ByteString? get(ByteString name);
sequence<ByteString> getSetCookie();
[Throws]
boolean has(ByteString name);
[Throws]

View file

@ -23,33 +23,15 @@
[Headers.prototype.append works for set-cookie]
expected: FAIL
[Headers.prototype.getSetCookie with no headers present]
expected: FAIL
[Headers.prototype.getSetCookie with one header]
expected: FAIL
[Headers.prototype.getSetCookie with one header created from an object]
expected: FAIL
[Headers.prototype.getSetCookie with multiple headers]
expected: FAIL
[Headers.prototype.getSetCookie with an empty header]
expected: FAIL
[Headers.prototype.getSetCookie with two equal headers]
expected: FAIL
[Headers.prototype.getSetCookie ignores set-cookie2 headers]
expected: FAIL
[Headers.prototype.getSetCookie preserves header ordering]
expected: FAIL
[Set-Cookie is a forbidden response header]
expected: FAIL
[Headers iterator is correctly updated with set-cookie changes #2]
expected: FAIL
@ -79,33 +61,15 @@
[Headers.prototype.append works for set-cookie]
expected: FAIL
[Headers.prototype.getSetCookie with no headers present]
expected: FAIL
[Headers.prototype.getSetCookie with one header]
expected: FAIL
[Headers.prototype.getSetCookie with one header created from an object]
expected: FAIL
[Headers.prototype.getSetCookie with multiple headers]
expected: FAIL
[Headers.prototype.getSetCookie with an empty header]
expected: FAIL
[Headers.prototype.getSetCookie with two equal headers]
expected: FAIL
[Headers.prototype.getSetCookie ignores set-cookie2 headers]
expected: FAIL
[Headers.prototype.getSetCookie preserves header ordering]
expected: FAIL
[Set-Cookie is a forbidden response header]
expected: FAIL
[Headers iterator is correctly updated with set-cookie changes #2]
expected: FAIL