blob: c7b8350045ddc97fbee5a05c5f20c8ce30203a96 [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Response status and statusText given various HTTP response status lines.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(test => {
return fetch("resources/status-normal.txt").then((response) => {
assert_equals(response.status, 200);
assert_equals(response.statusText, "OK");
});
}, "Normal status text.");
promise_test(test => {
return fetch("resources/status-with-message.asis").then((response) => {
assert_equals(response.status, 200);
assert_equals(response.statusText, "Alpha");
});
}, "Abnormal status text.");
promise_test(test => {
return fetch("resources/status-without-message.asis").then((response) => {
assert_equals(response.status, 200);
assert_equals(response.statusText, "");
});
}, "Empty status text.");
promise_test(test => {
let promise = fetch("resources/status-garbage.asis");
return promise_rejects(test, new TypeError(), promise);
}, "Garbage status line.");
</script>
</body>
</html>