summaryrefslogtreecommitdiff
path: root/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2017-09-14 11:05:10 +0200
committerMatteo Collina <hello@matteocollina.com>2017-09-20 11:32:29 +0200
commit8589c70c85411c2dd0e02c021d926b1954c74696 (patch)
tree46c7b7f54e8d4156cb7cbccf27d16400dd7d019e /test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js
parent2f5bef4705de7aefeaf58d15ee270239d98d5b89 (diff)
downloadandroid-node-v8-8589c70c85411c2dd0e02c021d926b1954c74696.tar.gz
android-node-v8-8589c70c85411c2dd0e02c021d926b1954c74696.tar.bz2
android-node-v8-8589c70c85411c2dd0e02c021d926b1954c74696.zip
http: revert #14024 writable is never set to false
Setting writable = false in IncomingMessage.end made some errors being swallowed in some very popular OSS libraries that we must support. This commit add some of those use cases to the tests, so we avoid further regressions. We should reevaluate how to set writable = false in IncomingMessage in a way that does not break the ecosystem. See: https://github.com/nodejs/node/pull/14024 Fixes: https://github.com/nodejs/node/issues/15029 PR-URL: https://github.com/nodejs/node/pull/15404 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js')
-rw-r--r--test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js b/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js
index 6a5c170e71..1614955be8 100644
--- a/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js
+++ b/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js
@@ -1,14 +1,13 @@
'use strict';
const common = require('../common');
const http = require('http');
+const assert = require('assert');
const util = require('util');
const stream = require('stream');
// Verify that when piping a stream to an `OutgoingMessage` (or a type that
// inherits from `OutgoingMessage`), if data is emitted after the
-// `OutgoingMessage` was closed - no `write after end` error is raised (this
-// should be the case when piping - when writing data directly to the
-// `OutgoingMessage` this error should be raised).
+// `OutgoingMessage` was closed - a `write after end` error is raised
function MyStream() {
stream.call(this);
@@ -22,8 +21,10 @@ const server = http.createServer(common.mustCall(function(req, res) {
process.nextTick(common.mustCall(() => {
res.end();
myStream.emit('data', 'some data');
+ res.on('error', common.mustCall(function(err) {
+ assert.strictEqual(err.message, 'write after end');
+ }));
- // If we got here - 'write after end' wasn't raised and the test passed.
process.nextTick(common.mustCall(() => server.close()));
}));
}));