From 0f45ecb68c40f70ad48ea31913f97f8689c9f327 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 30 Jun 2018 01:14:12 +0200 Subject: [PATCH] test: add http _dump regression test Test part of 299da1f503, specifically for v8.x. PR-URL: https://github.com/nodejs/node/pull/21595 Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca --- test/parallel/test-http-pause-no-dump.js | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/parallel/test-http-pause-no-dump.js diff --git a/test/parallel/test-http-pause-no-dump.js b/test/parallel/test-http-pause-no-dump.js new file mode 100644 index 00000000000000..b794634c489326 --- /dev/null +++ b/test/parallel/test-http-pause-no-dump.js @@ -0,0 +1,33 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const http = require('http'); + +const server = http.createServer(common.mustCall(function(req, res) { + req.once('data', common.mustCall(() => { + req.pause(); + res.writeHead(200); + res.end(); + res.on('finish', common.mustCall(() => { + assert(!req._dumped); + })); + })); +})); +server.listen(0); + +server.on('listening', common.mustCall(function() { + const req = http.request({ + port: this.address().port, + method: 'POST', + path: '/' + }, common.mustCall(function(res) { + assert.strictEqual(res.statusCode, 200); + res.resume(); + res.on('end', common.mustCall(() => { + server.close(); + })); + })); + + req.end(Buffer.allocUnsafe(1024)); +}));