Permalink
Browse files

add content-length header when posting file

  • Loading branch information...
1 parent e4fdc21 commit 59b57fa383817ac0f41778e97124e2169427c827 @xmilliard committed Sep 2, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/oauth.js
View
@@ -489,7 +489,11 @@ exports.OAuth.prototype.post= function(url, oauth_token, oauth_token_secret, pos
}
exports.OAuth.prototype.postFromFile= function(url, oauth_token, oauth_token_secret, fileName, post_content_type, callback) {
- return this._putOrPost("POST", url, oauth_token, oauth_token_secret, fileName, post_content_type, callback, true);
+ var self = this;
+ fs.stat(fileName, function(err, stats) {
+ self._headers["Content-length"]= stats.size;
+ return self._putOrPost("POST", url, oauth_token, oauth_token_secret, fileName, post_content_type, callback, true);
+ });
}

0 comments on commit 59b57fa

Please sign in to comment.