Skip to content

Commit

Permalink
Small simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
floatdrop committed Jul 23, 2015
1 parent b38a797 commit 8768176
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function requestAsEventEmitter(opts) {
var ee = new EventEmitter();
var redirectCount = 0;

function get(opts) {
var get = function (opts) {
var fn = opts.protocol === 'https:' ? https : http;
var url = urlLib.format(opts);

Expand All @@ -54,9 +54,7 @@ function requestAsEventEmitter(opts) {
return;
}

res = unzipResponse(res);

ee.emit('response', res);
ee.emit('response', unzipResponse(res));
}).once('error', function (err) {
ee.emit('error', new GotError('Request to ' + url + ' failed', err));
});
Expand All @@ -66,7 +64,7 @@ function requestAsEventEmitter(opts) {
}

setImmediate(ee.emit.bind(ee), 'request', req);
}
};

get(opts);
return ee;
Expand Down

0 comments on commit 8768176

Please sign in to comment.