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

Content-Type is not set when using req.form() #1684

Closed
eddiezane opened this issue Jul 20, 2015 · 7 comments · Fixed by #1687
Closed

Content-Type is not set when using req.form() #1684

eddiezane opened this issue Jul 20, 2015 · 7 comments · Fixed by #1687

Comments

@eddiezane
Copy link

It looks like v2.59.0 and #1650 broke the sendgrid library by making it so Content-Type is not set when using req.form(). A refactor is probably in order on our end, but just wanted to share https://github.com/sendgrid/sendgrid-nodejs/issues/178.

@simov
Copy link
Member

simov commented Jul 20, 2015

Thanks for the feedback @eddiezane, can you show me the relevant code on your end? #1650 should set the content-type header always if it's missing.

@marcbachmann
Copy link

I can confirm this bug:
Here's a request with request@2.58.0: http://requestb.in/17m0u4a1?inspect
screen shot 2015-07-20 at 7 47 09 pm

And one with request@2.59.0: http://requestb.in/15c7kfd1?inspect
screen shot 2015-07-20 at 7 50 49 pm

@simov
Copy link
Member

simov commented Jul 20, 2015

Wow, ok, that's the bug request/caseless@93d11f0 in the latest version of caseless, @mikeal any background info on this change?

Code to reproduce it (but I suspect that this potentially might have side effects in other places as well):

var request = require('request')
request({
  method: 'post',
  url: "http://requestb.in/15c7kfd1",
  formData: {
    file: "something"
  }
}, function(err, res, body) {
  if (err) return console.error(err);
  console.log(res.request.headers);
  console.log(body)
})

@tonylukasavage
Copy link

Also seeing this bug as described, specifically in my case:

var form = req.form();
form.append('file', fs.createReadStream('/path/to/file'));

would attach the appropriate Content-Type in 2.58.0, but now with 2.59.0 no Content-Type is in the headers.

@simov
Copy link
Member

simov commented Jul 21, 2015

Thanks for the feedback everyone, the fix is pushed here #1687 and it will be published shortly (read today).

@simov
Copy link
Member

simov commented Jul 21, 2015

2.60 is published.

@eddiezane
Copy link
Author

Thanks for working through this so quickly!

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

Successfully merging a pull request may close this issue.

4 participants