Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@akalsey akalsey authored
Showing with 6 additions and 3 deletions.
  1. +6 −2 lib/tropo-provisioning.js
  2. +0 −1  lib/tropo-session.js
View
8 lib/tropo-provisioning.js
@@ -91,10 +91,14 @@ TropoProvision.prototype.makeApiCall = function(method, host, path, payload) {
};
var request = https.request(requestOptions, function(response) {
// Process the response.
+ var data = '';
self.emit('responseCode', response.statusCode);
response.setEncoding('utf8');
- response.on('data', function(data) {
- self.emit('responseBody', data.toString());
+ response.on('data', function(chunk) {
+ data = data + chunk;
+ });
+ response.on('end', function() {
+ self.emit('responseBody', data);
});
});
if(payload) {
View
1  lib/tropo-session.js
@@ -1,5 +1,4 @@
var EventEmitter = require('events').EventEmitter;
-var sys = require('sys');
var https = require('https');
var sessionUrlHost = 'api.tropo.com';
Please sign in to comment.
Something went wrong with that request. Please try again.