diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-04-02 15:20:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 15:20:17 -0400 |
commit | c8fc29fcca0171166b7093d278bfbe03d970f1a5 (patch) | |
tree | a35816104d6ebe94d3c689d212b41fde2fc77aac /std/http/io_test.ts | |
parent | 7a9273d9cfa8736575317bb3cc9465e07ed4ed18 (diff) |
Revert "Respond with 400 on request parse failure" (#4593)
readRequest should not write a response.
This reverts commit 017a611131a35ccf5dbfce6a2a665fa569e32ec1.
Diffstat (limited to 'std/http/io_test.ts')
-rw-r--r-- | std/http/io_test.ts | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/std/http/io_test.ts b/std/http/io_test.ts index aa9c86130..768a4ffe4 100644 --- a/std/http/io_test.ts +++ b/std/http/io_test.ts @@ -5,7 +5,6 @@ import { assert, assertNotEOF, assertNotEquals, - assertMatch, } from "../testing/asserts.ts"; import { bodyReader, @@ -350,28 +349,13 @@ malformedHeader `; const reader = new BufReader(new StringReader(input)); let err; - let responseString: string; try { - // Capture whatever `readRequest()` attempts to write to the connection on - // error. We expect it to be a 400 response. - await readRequest( - mockConn({ - write(p: Uint8Array): Promise<number> { - responseString = decode(p); - return Promise.resolve(p.length); - }, - }), - reader - ); + await readRequest(mockConn(), reader); } catch (e) { err = e; } assert(err instanceof Error); assertEquals(err.message, "malformed MIME header line: malformedHeader"); - assertMatch( - responseString!, - /^HTTP\/1\.1 400 Bad Request\r\ncontent-length: \d+\r\n\r\n.*\r\n\r\n$/ms - ); }); // Ported from Go |