Index: third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-trailer.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-trailer.html b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-trailer.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5454040a35632e966db59b486a267a05e8ecaf57 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/response/response-trailer.html |
@@ -0,0 +1,24 @@ |
+<!doctype html> |
+<title>trailer() test</title> |
+<script src=/resources/testharness.js></script> |
+<script src=/resources/testharnessreport.js></script> |
+<div id=log></div> |
+<!-- based on /XMLHttpRequest/getresponseheader-chunked-trailer.htm --> |
+<script> |
+promise_test(() => { |
+ return fetch("/XMLHttpRequest/resources/chunked.py").then(res => { |
+ assert_equals(res.headers.get("Trailer"), "X-Test-Me") |
+ assert_equals(res.headers.get("X-Test-Me"), null) |
+ assert_equals(res.headers.get("Content-Type"), "text/plain") |
+ return Promise.all([ |
+ res.text().then(text => { |
+ assert_equals(text, "First chunk\r\nSecond chunk\r\nYet another (third) chunk\r\nYet another (fourth) chunk\r\n") |
+ }), |
+ res.trailer.then(trailers => { |
+ assert_equals(trailers.get("X-Test-Me"), "Trailer header value") |
+ assert_throws(new TypeError, () => trailers.append("Immutable-My-Ass", "Hi!")) |
+ }) |
+ ]) |
+ }) |
+}) |
+</script> |