Permalink
Browse files

add ability to sign request without buffering content (postFromFile and

getToFile)
  • Loading branch information...
1 parent efd44ca commit cadaf19094dbf7b8e4c86eb16c4c3e21eb9812ab @xmilliard committed Sep 21, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/oauth.js
View
12 lib/oauth.js
@@ -375,13 +375,13 @@ exports.OAuth.prototype._performSecureRequest= function( oauth_token, oauth_toke
var targetFile;
- if(method == "GET" && useFile) {
- targetFile = fs.createWriteStream(post_body);
- }
- else {
- response.setEncoding('utf8');
- }
request.on('response', function (response) {
+ if(method == "GET" && response.statusCode == 200 && useFile) {
+ targetFile = fs.createWriteStream(post_body);
+ }
+ else {
+ response.setEncoding('utf8');
+ }
response.on('data', function (chunk) {
if(targetFile) {
targetFile.write(chunk);

0 comments on commit cadaf19

Please sign in to comment.