| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7c03a3d commit 3e70b7d
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -352,7 +352,7 @@ function writeHead(statusCode, reason, obj) { | |||
| 352 | 352 | // writeHead(statusCode[, headers]) | |
| 353 | 353 | if (!this.statusMessage) | |
| 354 | 354 | this.statusMessage = STATUS_CODES[statusCode] || 'unknown'; | |
| 355 | - obj = reason; | ||
| 355 | + obj ??= reason; | ||
| 356 | 356 | } | |
| 357 | 357 | this.statusCode = statusCode; | |
| 358 | 358 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,3 +59,21 @@ const http = require('http'); | |||
| 59 | 59 | })); | |
| 60 | 60 | })); | |
| 61 | 61 | } | |
| 62 | + | ||
| 63 | + { | ||
| 64 | + const server = http.createServer(common.mustCall((req, res) => { | ||
| 65 | + res.writeHead(200, undefined, [ 'foo', 'bar' ]); | ||
| 66 | + res.end(); | ||
| 67 | + })); | ||
| 68 | + | ||
| 69 | + server.listen(0, common.mustCall(() => { | ||
| 70 | + http.get({ port: server.address().port }, common.mustCall((res) => { | ||
| 71 | + assert.strictEqual(res.statusMessage, 'OK'); | ||
| 72 | + assert.strictEqual(res.statusCode, 200); | ||
| 73 | + assert.strictEqual(res.headers.foo, 'bar'); | ||
| 74 | + res.resume().on('end', common.mustCall(() => { | ||
| 75 | + server.close(); | ||
| 76 | + })); | ||
| 77 | + })); | ||
| 78 | + })); | ||
| 79 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments