| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 65887b6 commit f882318
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const http = require('http'); | ||
| 6 | + | ||
| 7 | + const server = http.createServer(function(req, res) { | ||
| 8 | + res.writeHead(200); | ||
| 9 | + res.end(); | ||
| 10 | + }); | ||
| 11 | + | ||
| 12 | + server.listen(0, common.mustCall(() => { | ||
| 13 | + const req = http.get({ port: server.address().port }, (res) => { | ||
| 14 | + assert.strictEqual(res.statusCode, 200); | ||
| 15 | + res.resume(); | ||
| 16 | + server.close(); | ||
| 17 | + }); | ||
| 18 | + | ||
| 19 | + req.end(); | ||
| 20 | + })); | ||
| 21 | + | ||
| 22 | + // This timer should never go off as the server will close the socket | ||
| 23 | + setTimeout(common.mustNotCall(), common.platformTimeout(1000)).unref(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments