Permalink
Browse files

Merge pull request #5 from psobot/patch-1

Fixed error if user doesn't pass in a callback.
  • Loading branch information...
2 parents 37c8c59 + 88c17ee commit 890da6c9c172cf38d975bf0ab9a9a9c6346215f0 PostageApp committed Sep 24, 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 890da6c

Please sign in to comment.