| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 36332eb commit f3e6c76
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,25 +22,22 @@ | |||
| 22 | 22 | 'use strict'; | |
| 23 | 23 | const common = require('../common'); | |
| 24 | 24 | const http = require('http'); | |
| 25 | - const assert = require('assert'); | ||
| 26 | 25 | ||
| 27 | 26 | const server = http.createServer(common.mustNotCall()); | |
| 28 | 27 | ||
| 29 | - server.listen(0, function() { | ||
| 28 | + server.listen(0, common.mustCall(() => { | ||
| 30 | 29 | const req = http.request({ | |
| 31 | 30 | method: 'GET', | |
| 32 | 31 | host: '127.0.0.1', | |
| 33 | - port: this.address().port | ||
| 32 | + port: server.address().port | ||
| 34 | 33 | }); | |
| 35 | 34 | ||
| 36 | - req.on('error', function(ex) { | ||
| 37 | - // https://github.com/joyent/node/issues/1399#issuecomment-2597359 | ||
| 38 | - // abort() should emit an Error, not the net.Socket object | ||
| 39 | - assert(ex instanceof Error); | ||
| 40 | - }); | ||
| 35 | + req.on('abort', common.mustCall(() => { | ||
| 36 | + server.close(); | ||
| 37 | + })); | ||
| 38 | + | ||
| 39 | + req.on('error', common.mustNotCall()); | ||
| 41 | 40 | ||
| 42 | 41 | req.abort(); | |
| 43 | 42 | req.end(); | |
| 44 | - | ||
| 45 | - server.close(); | ||
| 46 | - }); | ||
| 43 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments