Skip to content

Double callback on GET request timeout #145

Description

@deandum

With the recent issue that Facebook had, we have been getting a lot of errors generated by the code below:

return request.get(this.options, function(err, res, body) {
    if (err) {
      self.callback({
          message: 'Error processing https request'
        , exception: err
      }, null);

      return;
    }

    if (~res.headers['content-type'].indexOf('image')) {
      body = {
          image: true
        , location: res.headers.location
      };
    }

    self.end(body);
  }).on('error', function(err) {
     self.callback({
          message: 'Error processing https request'
        , exception: err
      }, null);
  });

The error is caught twice here, resulting in double callbacks and may cause uncaught exceptions if not handled properly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions