Skip to content

Commit

Permalink
Merge pull request #1687 from simov/fix-caseless-bug
Browse files Browse the repository at this point in the history
Fix caseless bug - content-type not being set for multipart/form-data
  • Loading branch information
simov committed Jul 21, 2015
2 parents 33b15ee + 27722fe commit ff3a2cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion request.js
Expand Up @@ -573,7 +573,7 @@ Request.prototype.init = function (options) {

if (self._form && !self.hasHeader('content-length')) {
// Before ending the request, we had to compute the length of the whole form, asyncly
self.setHeader(self._form.getHeaders())
self.setHeader(self._form.getHeaders(), true)
self._form.getLength(function (err, length) {
if (!err) {
self.setHeader('content-length', length)
Expand Down
3 changes: 3 additions & 0 deletions tests/test-form-data.js
Expand Up @@ -29,6 +29,9 @@ function runTest(t, options) {
}
}

t.ok(/multipart\/form-data; boundary=--------------------------\d+/
.test(req.headers['content-type']))

// temp workaround
var data = ''
req.setEncoding('utf8')
Expand Down
3 changes: 3 additions & 0 deletions tests/test-form.js
Expand Up @@ -21,6 +21,9 @@ tape('multipart form append', function(t) {
return
}

t.ok(/multipart\/form-data; boundary=--------------------------\d+/
.test(req.headers['content-type']))

// temp workaround
var data = ''
req.setEncoding('utf8')
Expand Down

0 comments on commit ff3a2cc

Please sign in to comment.