Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Review fixes.
  • Loading branch information
Kasher committed Jul 20, 2017
commit 4aa3f4b4514c804758c6468cd894b6cef9383f55
2 changes: 1 addition & 1 deletion lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ OutgoingMessage.prototype.flush = internalUtil.deprecate(function() {

OutgoingMessage.prototype.pipe = function pipe() {
// OutgoingMessage should be write-only. Piping from it is disabled.
throw new Error('Pipe from a write-only stream');
this.emit('error', new Error('Cannot pipe, not readable'));
};

module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-outgoing-message-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const OutgoingMessage = require('_http_outgoing').OutgoingMessage;

const outgoingMessage = new OutgoingMessage();
assert.throws(
() => { outgoingMessage.pipe(outgoingMessage); },
common.mustCall(() => { outgoingMessage.pipe(outgoingMessage); }),
(err) => {
return ((err instanceof Error) && /Pipe from a write-only stream/.test(err));
return ((err instanceof Error) && /Cannot pipe, not readable/.test(err));
},
"OutgoingMessage.pipe should throw an error"
'OutgoingMessage.pipe should throw an error'
);