| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7836807 commit 4bcf1a0
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,23 +19,23 @@ const y = 'foo⠊Set-Cookie: foo=bar'; | |||
| 19 | 19 | ||
| 20 | 20 | var count = 0; | |
| 21 | 21 | ||
| 22 | + function test(res, code, header) { | ||
| 23 | + assert.throws(() => { | ||
| 24 | + res.writeHead(code, header); | ||
| 25 | + }, /^TypeError: The header content contains invalid characters$/); | ||
| 26 | + } | ||
| 27 | + | ||
| 22 | 28 | const server = http.createServer((req, res) => { | |
| 23 | 29 | switch (count++) { | |
| 24 | 30 | case 0: | |
| 25 | 31 | const loc = url.parse(req.url, true).query.lang; | |
| 26 | - assert.throws(common.mustCall(() => { | ||
| 27 | - res.writeHead(302, {Location: `/foo?lang=${loc}`}); | ||
| 28 | - })); | ||
| 32 | + test(res, 302, {Location: `/foo?lang=${loc}`}); | ||
| 29 | 33 | break; | |
| 30 | 34 | case 1: | |
| 31 | - assert.throws(common.mustCall(() => { | ||
| 32 | - res.writeHead(200, {'foo': x}); | ||
| 33 | - })); | ||
| 35 | + test(res, 200, {'foo': x}); | ||
| 34 | 36 | break; | |
| 35 | 37 | case 2: | |
| 36 | - assert.throws(common.mustCall(() => { | ||
| 37 | - res.writeHead(200, {'foo': y}); | ||
| 38 | - })); | ||
| 38 | + test(res, 200, {'foo': y}); | ||
| 39 | 39 | break; | |
| 40 | 40 | default: | |
| 41 | 41 | common.fail('should not get to here.'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments