()
| 34 | s.listen(0, test); |
| 35 | |
| 36 | function test() { |
| 37 | const bufs = []; |
| 38 | const client = net.connect( |
| 39 | this.address().port, |
| 40 | function() { |
| 41 | client.write( |
| 42 | 'GET / HTTP/1.1\r\n' + |
| 43 | 'Host: example.com\r\n' + |
| 44 | 'Connection: close\r\n\r\n'); |
| 45 | } |
| 46 | ); |
| 47 | client.on('data', function(chunk) { |
| 48 | bufs.push(chunk); |
| 49 | }); |
| 50 | client.on('end', common.mustCall(() => { |
| 51 | const head = Buffer.concat(bufs) |
| 52 | .toString('latin1') |
| 53 | .split('\r\n')[0]; |
| 54 | assert.strictEqual(head, 'HTTP/1.1 200 Custom Message'); |
| 55 | console.log('ok'); |
| 56 | s.close(); |
| 57 | })); |
| 58 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…