Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #12 from jharlap/provision_emits_end

TropoProvision now emits "end" when the response from Tropo ends
  • Loading branch information...
commit 33027e5ac2c3ecc8394a10fc9106fb9f47325669 2 parents cd3c052 + ff8e966
Adam Kalsey authored November 16, 2012
8  lib/tropo-provisioning.js
@@ -91,10 +91,14 @@ TropoProvision.prototype.makeApiCall = function(method, host, path, payload) {
91 91
 	};
92 92
 	var request = https.request(requestOptions, function(response) {
93 93
 		// Process the response.
  94
+		var data = '';
94 95
 		self.emit('responseCode', response.statusCode);
95 96
 		response.setEncoding('utf8');
96  
-		response.on('data', function(data) {
97  
-		    self.emit('responseBody', data.toString());
  97
+		response.on('data', function(chunk) {
  98
+			data = data + chunk;
  99
+		});
  100
+		response.on('end', function() {
  101
+			self.emit('responseBody', data);
98 102
 		});
99 103
 	});
100 104
 	if(payload) {
1  lib/tropo-session.js
... ...
@@ -1,5 +1,4 @@
1 1
 var EventEmitter = require('events').EventEmitter;
2  
-var sys = require('sys');
3 2
 var https = require('https');
4 3
 
5 4
 var sessionUrlHost = 'api.tropo.com';

0 notes on commit 33027e5

Please sign in to comment.
Something went wrong with that request. Please try again.