<!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_js(test, TypeError, promise);
}, "Garbage status line.");
</script>
</body>
</html>
