summaryrefslogtreecommitdiff
path: root/std/http/_io_test.ts
diff options
context:
space:
mode:
authorNoxazer <Noxazer-FR@users.noreply.github.com>2020-12-31 00:17:41 +0100
committerGitHub <noreply@github.com>2020-12-31 00:17:41 +0100
commit0163cedd804110cd410eb2cb92b299b0e555527f (patch)
tree5f67fa73cfafbf62851283e8edaf14914ae680eb /std/http/_io_test.ts
parente568ddf99687f635abe931c1eff2b8b37be3bc54 (diff)
fix(std/http): parsing of HTTP version header (#8902)
Diffstat (limited to 'std/http/_io_test.ts')
-rw-r--r--std/http/_io_test.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/std/http/_io_test.ts b/std/http/_io_test.ts
index 14675a799..7c1a80a2f 100644
--- a/std/http/_io_test.ts
+++ b/std/http/_io_test.ts
@@ -407,6 +407,11 @@ Deno.test("testReadRequestError", async function (): Promise<void> {
in: "GET / HTTP/1.1\r\nheader:foo\r\n",
err: Deno.errors.UnexpectedEof,
},
+ {
+ in: "POST / HTTP/1.0\r\n\r\n",
+ headers: [],
+ version: true,
+ },
{ in: "", eof: true },
{
in: "HEAD / HTTP/1.1\r\nContent-Length:4\r\n\r\n",
@@ -472,6 +477,12 @@ Deno.test("testReadRequestError", async function (): Promise<void> {
assert(err instanceof (test.err as typeof Deno.errors.UnexpectedEof));
} else {
assert(req instanceof ServerRequest);
+ if (test.version) {
+ // return value order of parseHTTPVersion() function have to match with [req.protoMajor, req.protoMinor];
+ const version = parseHTTPVersion(test.in.split(" ", 3)[2]);
+ assertEquals(req.protoMajor, version[0]);
+ assertEquals(req.protoMinor, version[1]);
+ }
assert(test.headers);
assertEquals(err, undefined);
assertNotEquals(req, null);