Skip to content

Commit

Permalink
Merge pull request #5 from psobot/patch-1
Browse files Browse the repository at this point in the history
Fixed error if user doesn't pass in a callback.
  • Loading branch information
PostageApp committed Sep 24, 2012
2 parents 37c8c59 + 88c17ee commit 890da6c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/postageapp.js
Expand Up @@ -54,9 +54,11 @@ module.exports = function(apiKey) {

request.on('response', function (response) {
response.setEncoding('utf8');
response.on('data', function (chunk) {
callback(null, chunk);
});
if (typeof callback !== 'undefined') {
response.on('data', function (chunk) {
callback(null, chunk);
});
}
});
request.end(JSON.stringify(payload));
},
Expand Down

0 comments on commit 890da6c

Please sign in to comment.