mikeal/request — Issue #156: Cannot pipe to process.stdout
Author: rwdaigle
Created: 2012-01-13 18:00:52+00:00
State: open

I'm observing very inconsistent behavior when piping to writeable streams. The following pipes work as expected for me:

```javascript
request('http://google.com/doodle.png').pipe(process.stderr);
request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
```

However, piping to `process.stdout` fails every time:

```javascript
request('http://google.com/doodle.png').pipe(process.stdout);

/Users/ryan/Dropbox/Personal/Development/side/heroku.js/node_modules/request/main.js:562
if (!this.response) throw new Error("This request has been piped before http
^
Error: This request has been piped before http.request() was called.
at Request.resume (/Users/ryan/Dropbox/Personal/Development/side/heroku.js/node_modules/request/main.js:562:29)
at WriteStream.ondrain (stream.js:48:14)
at WriteStream.emit (events.js:64:17)
at Object.afterWrite [as oncomplete] (net.js:481:10)
```

What is so different about the writeable stream implementation of process.stdout that it behaves differently than its brethren, even process.stderr?

I am on request v2.9.3 and node v0.6.6.