Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add Request.prototype.setHeader() #150

Closed
indexzero opened this issue Jan 11, 2012 · 1 comment
Closed

Proposal: Add Request.prototype.setHeader() #150

indexzero opened this issue Jan 11, 2012 · 1 comment

Comments

@indexzero
Copy link

@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:

  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?

@mikeal
Copy link
Member

mikeal commented Jan 11, 2012

we talked about unifying this API in core as well but never finished it.

i'm all for this going in to request.

@mikeal mikeal closed this as completed in 07bbf33 Feb 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants