mikeal/filed — Issue #12: Error running `request({ uri: 'http:...' }).pipe(filed('/file'))`
Author: indexzero
Created: 2012-01-12 10:53:23+00:00
State: open

There are a couple of problems here:

1. Since `self.method` is defined piping fails because the destination has no method .setHeader(). Looks like a miss on capability detection.

```
/a-project/node_modules/filed/main.js:87
self.dest.setHeader('content-type', self.mimetype)
^
TypeError: Cannot call method 'setHeader' of undefined
at /a-project/node_modules/filed/main.js:87:19
at Object.oncomplete (/a-project/node_modules/filed/main.js:152:7)
```

2. Even if that is fixed since the request method is not `HEAD` it will attempt to pipe to an undefined destination:

```
stream.js:52
dest.on('drain', ondrain);
^
TypeError: Cannot call method 'on' of undefined
at [object Object].pipe (stream.js:52:8)
at /a-project/node_modules/filed/main.js:111:42
at Object.oncomplete (/a-project/node_modules/filed/main.js:154:7)
```

With both of those fixed I'm seeing empty files on disk. This may be a problem in some implementation on my end so I'm investigating further, but those two errors are definitely small bugs.