Make a X-Domain request to url and callback.

@param {String} url
@returns {Promise} with response text if fulfilled
494472
function _xdr(url) {
        return new Promise(function(resolve, reject) {
            var req = new XMLHttpRequest();
            req.open('get', url);
            req.onerror = reject;
            req.onreadystatechange = function onreadystatechange() {
                if (req.readyState === 4) {
                    if ((req.status >= 200 && req.status < 300) ||
                        (url.substr(0, 7) === 'file://' && req.responseText)) {
                        resolve(req.responseText);
                    } else {
                        reject(new Error('HTTP status: ' + req.status + ' retrieving ' + url));
                    }
                }
            };
            req.send();
        });

    }
838545
function request (method, url) {
  // callback
      if ('function' === typeof url) {
        return new Request('GET', method).end(url)
      }

  // url first
      if (1 === arguments.length) {
        return new Request('GET', method)
      }

      return new Request(method, url)
    }
1090538
function getFeed(url, callback) {
  getXmlString(url).then(xmlStringToJSON).then(callback).catch(callback);
}
558840
function xhr (url, options, callback) {
  if (typeof options === 'function') {
    callback = options
    options = null
  }
  const o = options || {}
  const req = new XMLHttpRequest()
  const method = o.method || 'get'
  const params = o.data || null

  req.queryString = params
  req.open(method, url, true)
  req.setRequestHeader('X-Requested-With', 'XMLHttpRequest')

  if (method.toLowerCase() === 'post') {
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
  }

  for (let key in o.headers) {
    if (o.headers.hasOwnProperty(key)) {
      req.setRequestHeader(key, o.headers[key])
    }
  }

  function stateChange () {
    if (req.readyState === 4) {
      if ((/^[20]/).test(req.status)) {
        callback(null, req.responseText)
      } else if ((/^[45]/).test(req.status)) {
        callback(new Error(req.status))
      }
    }
  }

  req.onreadystatechange = stateChange

  try {
    req.send(params)
  } catch (e) {
    // eslint-disable-next-line no-console
    console.log('Error: Resolving URL ' + url)
    callback(e)
  }
}
1022591
def _make_request(self, url, **kwargs):
        
        response = requests.post(url, **kwargs)
        try:
            return response.json()
        except ValueError:
            pass
        return parse_qs(response.content)
918175
function getQueryResponse(url) {
    var response;
    if (options.stopQueryParam) {
      var parsedUrl = parseUrl(url, true);

      if (parsedUrl.query && parsedUrl.query[options.stopQueryParam]) {
        var queryResponse = parseInt(parsedUrl.query[options.stopQueryParam]);
        if (queryResponse > 1) {
          response = queryResponse;
        }
      }
    }

    return response;
  }
616654
function getUrl (url) {
  var opt = {
    url: url
  , timeout: 10000 // 10 seconds
  }
  ;
  return new Promise(function(resolve, reject){
    request(opt, function(err, res, body){
      if (err) { return reject(err); }
      resolve(body)
    });
  });
}
851045
function get(url, opts){
	opts = opts || {};

	return requestp(_.extend(defaults, opts, {
		url: url
	}));
}
331038
function Xttp(url, params, fn) {
  const request = new Xttp.Request(url, params);
  fn && request.end(fn);
  return request;
}
259261
function getResponseUrl(xhr) {
    if ('responseURL' in xhr && xhr.responseURL) {
        return xhr.responseURL;
    }
    if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
        return xhr.getResponseHeader('X-Request-URL');
    }
    return null;
}
1248267
function(url){
			var rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
				urlLower = url.toLowerCase(),
				parts = rurl.exec( urlLower ),
				ajaxLocation,
				ajaxLocParts;

			try {
				ajaxLocation = location.href;
			} catch( e ) {
				// Use the href attribute of an A element
				// since IE will modify it given document.location
				ajaxLocation = document.createElement('a');
				ajaxLocation.href = '';
				ajaxLocation = ajaxLocation.href;
			}

			ajaxLocation = ajaxLocation.toLowerCase();

			// uh oh, the url must be relative
			// make it fully qualified and re-regex url
			if (!parts){
				urlLower = _absolutizeURI(ajaxLocation,urlLower).toLowerCase();
				parts = rurl.exec( urlLower );
			}

			// Segment location into parts
			ajaxLocParts = rurl.exec( ajaxLocation ) || [];

			// do hostname and protocol and port of manifest URL match location.href? (a "local" request on the same domain)
			var matched = !(parts &&
					(parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
						(parts[ 3 ] || (parts[ 1 ] === 'http:' ? '80' : '443')) !==
							(ajaxLocParts[ 3 ] || (ajaxLocParts[ 1 ] === 'http:' ? '80' : '443'))));
		
			return matched;
		}
80922
function(url, opts) {
    var that = this;
    var buf_pos = 0;
    var orsc = function (xhr, e, abort_reason) {
        if (xhr.readyState === 3 || xhr.readyState === 4) {
            // IE doesn't like peeking into responseText or status on
            // XHR and readystate=3
            try {
                var responseText = xhr.responseText;
                var status = xhr.status;
            } catch (x) {}
            if (responseText && status === 200) {
                var msgs = [];
                while (1) {
                    var buf = responseText.slice(buf_pos);
                    var p = buf.indexOf('\n');
                    if (p === -1) break;
                    buf_pos += p+1;
                    var msg = buf.slice(0, p);
                    that.dispatchEvent(
                        new SimpleEvent('message', {
                                            data: msg,
                                            readystate: xhr.readyState,
                                            responsetext: responseText
                                        }));
                }
            }
        }
        if (xhr.readyState === 4 || abort_reason) {
            var reason = abort_reason ? 'user' :
                (xhr.status === 200 ? 'network' : 'permanent');
            that.xhr_close = null;
            that.dispatchEvent(new SimpleEvent('close', {reason: reason}));
        }
    };
    var createXhr = (opts.cors && _window.XDomainRequest) ?
                                    utils.createXDR : utils.createXHR;
    that.xhr_close = createXhr('POST', url, null, orsc);
}
437678
function (url, callback) {
      pendingRequests[url] = true;
      var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp");
      xhr.open("HEAD", url, true);
      xhr.onreadystatechange = function () {
        delete pendingRequests[url];
        if (xhr.readyState == 4 && xhr.status != 304) {
          xhr.getAllResponseHeaders();
          var info = {};
          for (var h in headers) {
            var value = xhr.getResponseHeader(h);
            // adjust the simple Etag variant to match on its significant part
            if (h.toLowerCase() == "etag" && value) value = value.replace(/^W\//, '');
            if (h.toLowerCase() == "content-type" && value) value = value.replace(/^(.*?);.*?$/i, "$1");
            info[h] = value;
          }
          callback(url, info);
        }
      }
      xhr.send();
    }
851841
function fetch( url, callback ) {
    request({ url: url, json: true }, function( err, resp, data ) {
        if (err) {
            return callback(err);
        }

        if ( 200 != resp.statusCode ) {
            return callback(new Error(resp.statusMessage));
        }

        callback(data);
    });
}
31688
function(url, method = 'get', body = undefined) {
		var deferred = Q.defer();
		let self = this;

		try {
			let req = undefined;

			// Create request object
			switch (method.toLowerCase().trim()) {
				case 'post': {
					req = request.post(url).send(body);
					break;
				}
				case 'patch': {
					req = request.patch(url).send(body);
					break;
				}
				case 'put': {
					req = request.put(url).send(body);
					break;
				}
				case 'delete': {
					req = request.delete(url);
					break;
				}
				case 'get': {
					req = request.get(url);
					break;
				}
				default: {
					throw new Error(`Unsupported HTTP verb: ${method}`);
				}
			}

			self.requestCount++;

			// Set standard stuff and handle response
			req
				.set('Authorization', 'token ' + config.token)
				.then(function(res) {
					self.logRequestSuccess(res);
					deferred.resolve({
						body: res.body,
						headers: res.headers
					});
				}, 
				function(err) {
					// TODO: handle rate limiting (github sends a 403, not a 429)
					// https://developer.github.com/v3/#rate-limiting
					log.error(err);
					deferred.reject(err);
				});
		} catch(err) {
			log.error(err);
			deferred.reject(err);
		}

		return deferred.promise;
	}
649346
function ajax(url, options, callback, data, cache) {
  try {
    var x = new (XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0');
    x.open(data ? 'POST' : 'GET', url, 1);
    if (!options.crossDomain) {
      x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
    }
    if (options.authorize && options.apiKey) {
      x.setRequestHeader('Authorization', options.apiKey);
    }
    if (data || options.setContentTypeJSON) {
      x.setRequestHeader('Content-type', 'application/json');
    }
    x.onreadystatechange = function() {
      x.readyState > 3 && callback && callback(x.responseText, x);
    };
    x.send(JSON.stringify(data));
  } catch (e) {
    window.console && console.log(e);
  }
}
77321
function networkRequest(url: string, opts: any): Promise<*> {
  if (url.startsWith(InlineBase64JSON)) {
    const content = atob(url.slice(url.indexOf("base64") + 7));
    return Promise.resolve({ content });
  }

  return Promise.race([
    fetch(`/get?url=${url}`).then(res => {
      if (res.status >= 200 && res.status < 300) {
        if (res.headers.get("Content-Type") === "application/wasm") {
          return res.arrayBuffer().then(buffer => ({
            content: buffer,
            isDwarf: true
          }));
        }
        return res.text().then(text => ({ content: text }));
      }
      return Promise.reject(new Error(`failed to request ${url}`));
    }),
    new Promise((resolve, reject) => {
      setTimeout(() => reject(new Error("Connect timeout error")), 6000);
    })
  ]);
}