| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b5ad655 commit 8476537
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const { createServer } = require('http'); | ||
| 4 | + const { connect } = require('net'); | ||
| 5 | + | ||
| 6 | + // Make sure that calling the semi-private close() handlers manually doesn't | ||
| 7 | + // cause an error. | ||
| 8 | + | ||
| 9 | + const server = createServer(common.mustCall((req, res) => { | ||
| 10 | + req.client._events.close.forEach((fn) => { fn.bind(req)(); }); | ||
| 11 | + })); | ||
| 12 | + | ||
| 13 | + server.unref(); | ||
| 14 | + | ||
| 15 | + server.listen(0, common.mustCall(() => { | ||
| 16 | + const client = connect(server.address().port); | ||
| 17 | + | ||
| 18 | + const req = [ | ||
| 19 | + 'POST / HTTP/1.1', | ||
| 20 | + 'Content-Length: 11', | ||
| 21 | + '', | ||
| 22 | + 'hello world', | ||
| 23 | + ].join('\r\n'); | ||
| 24 | + | ||
| 25 | + client.end(req); | ||
| 26 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments