Skip to content

Commit

Permalink
test: add http _dump regression test
Browse files Browse the repository at this point in the history
Test part of 299da1f, specifically for v8.x.

PR-URL: #21595
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
addaleax authored and rvagg committed Aug 16, 2018
1 parent 8f5e991 commit 0f45ecb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/parallel/test-http-pause-no-dump.js
Original file line number Diff line number Diff line change
@@ -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));
}));

0 comments on commit 0f45ecb

Please sign in to comment.