impl = function() {

      if (opts.successiveRetryCount >= self.hosts.length) {
        var error = { message: 'Cannot connect the Algolia\'s Search API. Please send an email to support@algolia.com to report the issue.' };
        if (!self._isUndefined(callback) && callback) {
          opts.successiveRetryCount = 0;
          callback(false, error);
        }
        deferred && deferred.reject(error);
        return;
      }
      opts.callback = function(retry, success, body) {
        if (success && !self._isUndefined(opts.cache)) {
          cache[cacheID] = body;
        }
        if (!success && retry) {
          self.currentHostIndex = ++self.currentHostIndex % self.hosts.length;
          opts.successiveRetryCount += 1;
          impl();
        } else {
          opts.successiveRetryCount = 0;
          deferred && (success ? deferred.resolve(body) : deferred.reject(body));
          if (!self._isUndefined(callback) && callback) {
            callback(success, body);
          }
        }
      };
      opts.hostname = self.hosts[self.currentHostIndex];
      self._jsonRequestByHost(opts);
    }
Add an extra field to the HTTP request

@param key the header field name
@param value the header field value