Skip to content

Commit

Permalink
Fix transit response to return Duplex streams without a read method
Browse files Browse the repository at this point in the history
  • Loading branch information
felipegcampos committed Jul 13, 2018
1 parent 05d8122 commit 91d527b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transit.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ class Transit {
* @memberof Transit
*/
_sendRequest(ctx, resolve, reject) {
const isStream = ctx.params && typeof ctx.params.on === "function" && typeof ctx.params.read === "function" && typeof ctx.params.pipe === "function";
const isStream = ctx.params && ctx.params.readable === true && typeof ctx.params.on === "function" && typeof ctx.params.pipe === "function";

const request = {
action: ctx.action,
Expand Down Expand Up @@ -751,7 +751,7 @@ class Transit {

const publishCatch = err => this.logger.error(`Unable to send '${id}' response to '${nodeID}' node.`, err);

if (data && typeof data.on === "function" && typeof data.read === "function" && typeof data.pipe === "function") {
if (data && data.readable === true && typeof data.on === "function" && typeof data.pipe === "function") {
// Streaming response
payload.stream = true;
const stream = data;
Expand Down

0 comments on commit 91d527b

Please sign in to comment.