mikeal/request — Issue #150: Proposal: Add Request.prototype.setHeader()
Author: indexzero
Created: 2012-01-11 07:56:05+00:00
State: open

@mikeal Been playing around with `filed` and `request` in conjunction with a Rackspace Cloudfiles client and I realized that adding `Request.prototype.setHeader()`would create a really elegant:

``` js
var filed = require('filed'),
request = require('request');

filed('path/to/some/file.mp3').pipe(request({
method: 'PUT',
uri: 'http://uri.to.cloudfiles.com/container/file.mp3'
});
```

Cloudfiles (and S3 I believe) expect incoming headers `content-type` and `content-length` which `filed` will set automatically for `http.ServerResponse` objects, but not for `Request` objects. Adding `Request.prototype.setHeader()` here and a minor change in `filed` would do the trick.

Thoughts?