Permalink
Browse files

Fixed error if user doesn't pass in a callback.

  • Loading branch information...
1 parent 37c8c59 commit 88c17ee6c5e5d1fe2d2c617c3246dea300736ac2 @psobot psobot committed Sep 22, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/postageapp.js
View
@@ -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));
},

0 comments on commit 88c17ee

Please sign in to comment.