Skip to content

Commit

Permalink
Adds content-length calculation when submitting forms using form-data…
Browse files Browse the repository at this point in the history
… library. This is related to issue 345.
  • Loading branch information
Juul committed Feb 2, 2014
1 parent 1ee266e commit d134f01
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions request.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ Request.prototype.init = function (options) {

if (self._form) {
self.setHeaders(self._form.getHeaders())
try {
var length = self._form.getLengthSync()
self.setHeader('content-length', length)
} catch(e){}
self._form.pipe(self)
}
if (self.body) {
Expand Down

0 comments on commit d134f01

Please sign in to comment.