Fire http request and callback when done.

@param  {String}   urlStr   The url.
@param  {Function} callback Callback with error, response and responstime.
191191
function fireRequest(urlStr, callback) {
  var start = Date.now();

  request({
    url: urlStr,
    method: 'GET',
    maxRedirects: 8,
    timeout: 10 * 1000
    //headers: { 'User-Agent': 'woobot/2.0' }
  }, function (error, response) {
    callback(error, response, Date.now() - start);
  });
}
519403
function _fireReadFileCallbacks(filename, data, error=false) {
  const callbacks = readFileCallbacks.get(filename);
  if (callbacks) {
    if (callbacks.size) callbacks.forEach(callback=>error?callback(data, null):callback(null, data));
    callbacks.clear();
    readFileCallbacks.delete(filename);
  }
}
961337
function maybeFireCallback() {
		// This function is called in any place where we might have completed a task that allows us to fire

		if (callbackFired) return;

		// If everything is ready, we *should* fire the callback, and it hasn't already been fired, then do so
		if (stdoutReady && stderrReady && wantCallback && !callbackFired) {
			callbackFired = true;
			callback(callbackErr, stdout);
		}
	}
1286401
function ajax(url, callback, data) {
  if (data) {
    var reqOptions = typeof url === 'string' ? { uri: url, body: data, json: true } : _extends({}, url, { body: data, json: true });
    _request2.default.post(reqOptions, function (err, res, body) {
      if (err) console.log(err);
      callback(err, body, res);
    });
  } else {
    (0, _request2.default)(url, function (err, res, body) {
      if (err) console.log(err);
      callback(err, body, res);
    });
  }
}
573081
function(callback) {

      var self = this;

      this.queue.add(function() {
        if (callback) {
          callback(self.error, self._getUrl()); 
        }
      });

    }
1107346
function makeCallback(callback) {
  if (_.isFunction(callback)) {
    return callback;
  }
  var result = function() { return callback; };
  result._callback = callback;
  return result;
}
533866
function sendErrorResponse(err, callback = undefined, returnData = undefined) {
  let error;
  if (err instanceof Error) {
    error = err;
  } else {
    error = new Error(err);
  }

  if (callback) {
    callback(error, returnData);
  } else {
    throw error;
  }
}
476475
public static void post(String url, String paramData,
                            ResponseCallback callback) {
        post(url, paramData, null, callback);
    }
297981
function (parameters,callback) {
        var queryString = parameters.appKey ? 'appkey=' + parameters.appKey : "";

        var parsedUrl = urlParser.parse(parameters.clusterUri + '?' + queryString);
        
        httpRequest.get({
            url : parsedUrl.hostname,        
            path : parsedUrl.pathname,
            parameters : parsedUrl.query,
            callback : function(error,responseData){
                if (error != null) {
                    callback(error, null);
                }
                else {
                    callback(null, responseData.content);
                }
            }
        });
    }
1215059
function handler ( err, data ){
      if ( callback != null ){
        callback.apply( b9, arguments );
      }
      // only emit events when there is no error
      if ( err == null ){
        b9.emit.call( b9, method, data );
      }
    }
87077
function callbackMiddleware (req, res, next) {
  if (req.url.indexOf('callback') === -1) {
    next()
  } else if (req.url.indexOf('error') === -1) {
    res.status(200).jsonp({ created: true })
  } else {
    res.status(400).jsonp({ error: true })
  }
}
62411
function callback(err, hasError) {

    if (err !== null) {
        console.log(chalk.red('Error running JSHint over project: %j\n'), err);
    }

    if (hasError) {
        console.log(chalk.blue('\nSummary\n=======\n'));
        for (var errorCode in errors) {
            if (errors.hasOwnProperty(errorCode)) {
                displaySummary(errorCode);
            }
        }

        console.log('');

        if (totalErrors > 1) {
            console.log(chalk.red('Found %d errors.\n'), totalErrors);
        } else {
            console.log(chalk.red('Found 1 error.\n'));
        }
    } else {
        console.log(chalk.green('No JSHint errors found.\n'));
    }
}
84732
function(url, callback) {
      
      // TODO: if url is not in the same domain, we should use jsonp !
      util.Connect.asyncRequest('GET', url, { 
         success: function(o) {
            try {
               this._smd = lang.JSON.parse(o.responseText);
               this.process(callback);
            }
            catch(ex) {
               if(lang.isObject(console) && lang.isFunction(console.log))
                  console.log(ex);
               if( lang.isFunction(callback.failure) ) {
                  callback.failure.call(callback.scope || this, {error: ex});
               }
            }
         }, 
         failure: function(o) {
            if( lang.isFunction(callback.failure) ) {
               callback.failure.call(callback.scope || this, {error: "unable to fetch url "+url});
            }
         },
         scope: this
      });
   }
1198605
function (urlStr) {
        var protocol = Url.isUrl(urlStr) ? urlStr.protocol : _.trimEnd(nodeUrl.parse(urlStr || E).protocol || E, COLON);

        // to allow target URLs without any protocol. e.g.: 'foo.com/bar'
        if (_.isEmpty(protocol)) {
            protocol = DEFAULT_PROTOCOL;
            urlStr = protocol + PROTOCOL_HOST_SEPARATOR + urlStr;
        }

        // this ensures we don't proceed any further for any non-supported protocol
        if (!_.includes(ALLOWED_PROTOCOLS, protocol)) {
            return false;
        }

        return this.match.test(urlStr);
    }
719121
function (url, data, onDone) {

    SR.Log('url to post: ' + url);

    // construct an HTTP request
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
    
    // set callback when response is returned
    xmlHttp.onloadend = onHttpResponse(xmlHttp, onDone);
	//console.log('data to send:');
	//console.log(data);
	
    // send the collected data as JSON
	// TODO: may be slow in Firefox?
	xmlHttp.send(Object.keys(data).length > 0 ? JSON.stringify(data) : undefined);
}
775540
function (url) {
		var current = this.current, params = current.params;

		var state = find(url);

		if (state.is_changed(current.name, params)) {
			this.current = state;
			this.trigger_event("state_changed", state);
			this.trigger_event("state_changed_success", url);
		}
	}
325711
function(remotePath, callback) {
            client
                .stat(remotePath)
                .then(function(stat) {
                    __executeCallbackAsync(callback, [null, __convertStat(stat)]);
                })
                .catch(callback);
        }