Skip to content

Commit

Permalink
[fix] Don't access the req.headers before checking if there's an error.
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
3rd-Eden committed Oct 1, 2013
1 parent 67b79c1 commit 3b04bd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ FullContact.prototype.request = function req(packet, args) {
, self = this;

request(packet, function requested(err, res, body) {
if (err) return fn(err);

self.ratereset = +res.headers['x-rate-limit-reset'] || self.ratereste;
self.ratelimit = +res.headers['x-rate-limit-limit'] || self.ratelimit;
self.remaining = +res.headers['x-rate-limit-remaining'] || self.remaining;

if (err) return fn(err);

//
// Parse response to JSON.
//
Expand Down

0 comments on commit 3b04bd8

Please sign in to comment.