lib/plugins/HttpPlugin.js
function parseUrl (url) {
  if (typeof URL === 'function') {
    // Use the new WHATWG URL API
    return new URL(url);
  }
  else {
    // Use the legacy url API
    var parsed = legacyURL.parse(url);

    // Replace nulls with default values, for compatibility with the WHATWG URL API
    parsed.pathname = parsed.pathname || '/';
    parsed.search = parsed.search || '';
  }
}
function parseUrl (url) {
  if (typeof URL === 'function') {
    // Use the new WHATWG URL API
    return new URL(url);
  }
  else {
    // Use the legacy url API
    var parsed = legacyURL.parse(url);

    // Replace nulls with default values, for compatibility with the WHATWG URL API
    parsed.pathname = parsed.pathname || '/';
    parsed.search = parsed.search || '';
  }
}
function parseUrl ( url ) { if ( typeof URL === 'function' ) { // Use the new WHATWG URL API return new URL ( url ) ; } else { // Use the legacy url API var parsed = legacyURL . parse ( url ) ; // Replace nulls with default values, for compatibility with the WHATWG URL API parsed . pathname = parsed . pathname || '/' ; parsed . search = parsed . search || '' ; } }
Parses the given URL, using either the legacy Node.js url API, or the WHATWG URL API.

@param {string} url
@returns {object}
Parses the given URL using either the legacy Node . js url API or the WHATWG URL API .