-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1689979 [wpt PR 27421] - HTTP/1 status code tests, a=testonly
Automatic update from web-platform-tests HTTP/1 status code tests For whatwg/fetch#1142 and whatwg/fetch#1159. -- wpt-commits: a0ff0251fc21d0acd2e2443a033b390f44399b43 wpt-pr: 27421 UltraBlame original commit: 5eee1e3543982e0b2782b3fe9dda6cd64f59e0c5
- Loading branch information
Showing
2 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
testing/web-platform/tests/fetch/h1-parsing/resources/status-code.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def main(request, response): | ||
output = "HTTP/1.1 " | ||
output += request.GET.first("input") | ||
output += "\n" + "header-parsing: is sad" + "\n" | ||
response.writer.write(output) | ||
response.close_connection = True |
98 changes: 98 additions & 0 deletions
98
testing/web-platform/tests/fetch/h1-parsing/status-code.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
[ | ||
{ | ||
input: "", | ||
expected: null | ||
}, | ||
{ | ||
input: "BLAH", | ||
expected: null | ||
}, | ||
{ | ||
input: "0 OK", | ||
expected: { | ||
status: 0, | ||
statusText: "OK" | ||
} | ||
}, | ||
{ | ||
input: "1 OK", | ||
expected: { | ||
status: 1, | ||
statusText: "OK" | ||
} | ||
}, | ||
{ | ||
input: "99 NOT OK", | ||
expected: { | ||
status: 99, | ||
statusText: "NOT OK" | ||
} | ||
}, | ||
{ | ||
input: "077 77", | ||
expected: { | ||
status: 77, | ||
statusText: "77" | ||
} | ||
}, | ||
{ | ||
input: "099 HELLO", | ||
expected: { | ||
status: 99, | ||
statusText: "HELLO" | ||
} | ||
}, | ||
{ | ||
input: "200", | ||
expected: { | ||
status: 200, | ||
statusText: "" | ||
} | ||
}, | ||
{ | ||
input: "999 DOES IT MATTER", | ||
expected: { | ||
status: 999, | ||
statusText: "DOES IT MATTER" | ||
} | ||
}, | ||
{ | ||
input: "1000 BOO", | ||
expected: null | ||
}, | ||
{ | ||
input: "0200 BOO", | ||
expected: null | ||
}, | ||
{ | ||
input: "65736 NOT 200 OR SOME SUCH", | ||
expected: null | ||
}, | ||
{ | ||
input: "131072 HI", | ||
expected: null | ||
}, | ||
{ | ||
input: "-200 TEST", | ||
expected: null | ||
}, | ||
{ | ||
input: "0xA", | ||
expected: null | ||
}, | ||
{ | ||
input: "C8", | ||
expected: null | ||
} | ||
].forEach(({ description, input, expected }) => { | ||
promise_test(async t => { | ||
if (expected !== null) { | ||
const response = await fetch("resources/status-code.py?input=" + input); | ||
assert_equals(response.status, expected.status); | ||
assert_equals(response.statusText, expected.statusText); | ||
assert_equals(response.headers.get("header-parsing"), "is sad"); | ||
} else { | ||
await promise_rejects_js(t, TypeError, fetch("resources/status-code.py?input=" + input)); | ||
} | ||
}, `HTTP/1.1 ${input} ${expected === null ? "(network error)" : ""}`); | ||
}); |