diff --git a/examples/streams-pipe.js b/examples/streams-pipe.js index 70075b8..4c5163c 100644 --- a/examples/streams-pipe.js +++ b/examples/streams-pipe.js @@ -40,18 +40,14 @@ app.use(function(next){ app.use(function(next){ return function *(){ - if (!this.hasContent) return yield next; + var body = this.body; - // TODO: fix ... - if (!this.body) return yield next; + if (!body || !body.readable) return yield next; - if (this.body.readable) { - var body = this.body; - var gzip = zlib.createGzip(); - this.set('Content-Encoding', 'gzip'); - this.body = gzip; - body.pipe(gzip); - } + var gzip = zlib.createGzip(); + this.set('Content-Encoding', 'gzip'); + this.body = gzip; + body.pipe(gzip); yield next; }