diff options
Diffstat (limited to 'test/parallel/test-http-client-finished.js')
-rw-r--r-- | test/parallel/test-http-client-finished.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/parallel/test-http-client-finished.js b/test/parallel/test-http-client-finished.js new file mode 100644 index 0000000000..2d7e5b95b3 --- /dev/null +++ b/test/parallel/test-http-client-finished.js @@ -0,0 +1,27 @@ +'use strict'; +const common = require('../common'); +const http = require('http'); +const { finished } = require('stream'); + +{ + // Test abort before finished. + + const server = http.createServer(function(req, res) { + res.write('asd'); + }); + + server.listen(0, common.mustCall(function() { + http.request({ + port: this.address().port + }) + .on('response', (res) => { + res.on('readable', () => { + res.destroy(); + }); + finished(res, common.mustCall(() => { + server.close(); + })); + }) + .end(); + })); +} |