mirror of
https://github.com/servo/servo.git
synced 2025-07-13 02:13:40 +01:00
24 lines
914 B
HTML
24 lines
914 B
HTML
<!doctype html>
|
|
<title>trailer() test</title>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<div id=log></div>
|
|
<!-- based on /xhr/getresponseheader-chunked-trailer.htm -->
|
|
<script>
|
|
promise_test(() => {
|
|
return fetch("/xhr/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>
|