function request(opts, cb) {
  if (typeof opts === 'string')
    opts = urlParse(opts);


  // Normally, the page is loaded from http or https, so not specifying a protocol
  // will result in a (valid) protocol-relative url. However, this won't work if
  // the protocol is something else, like 'file:'
  var defaultProtocol = global$1.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '';

  var protocol = opts.protocol || defaultProtocol;
  var host = opts.hostname || opts.host;
  var port = opts.port;
  var path = opts.path || '/';

  // Necessary for IPv6 addresses
  if (host && host.indexOf(':') !== -1)
    host = '[' + host + ']';

  // This may be a relative url. The browser should always be able to interpret it correctly.
  opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path;
  opts.method = (opts.method || 'GET').toUpperCase();
  opts.headers = opts.headers || {};

  // Also valid opts.auth, opts.mode

  var req = new ClientRequest$1(opts);
  if (cb)
    req.on('response', cb);
  return req
}
/*
this and http-lib folder

The MIT License

Copyright (c) 2015 John Hiesey

Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/
this and http-lib folder
The MIT License



Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions.

The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.


this and http - lib folder The MIT License Permission is hereby granted free of charge to any person obtaining a copy of this software and associated documentation files ( the " Software " ) to deal in the Software without restriction including without limitation the rights to use copy modify merge publish distribute sublicense and / or sell copies of the Software and to permit persons to whom the Software is furnished to do so subject to the following conditions . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software .
function request(opts, cb) {
  if (typeof opts === 'string')
    opts = urlParse(opts);
  var defaultProtocol = global$1.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '';
  var protocol = opts.protocol || defaultProtocol;
  var host = opts.hostname || opts.host;
  var port = opts.port;
  var path = opts.path || '/';
  if (host && host.indexOf(':') !== -1)
    host = '[' + host + ']';
  opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path;
  opts.method = (opts.method || 'GET').toUpperCase();
  opts.headers = opts.headers || {};
  var req = new ClientRequest$1(opts);
  if (cb)
    req.on('response', cb);
  return req
}
function request ( opts , cb ) { if ( typeof opts === 'string' ) opts = urlParse ( opts ) ; var defaultProtocol = global$1 . location . protocol . search ( / ^https?:$ / ) === - 1 ? 'http:' : '' ; var protocol = opts . protocol || defaultProtocol ; var host = opts . hostname || opts . host ; var port = opts . port ; var path = opts . path || '/' ; if ( host && host . indexOf ( ':' ) !== - 1 ) host = '[' + host + ']' ; opts . url = ( host ? ( protocol + '//' + host ) : '' ) + ( port ? ':' + port : '' ) + path ; opts . method = ( opts . method || 'GET' ) . toUpperCase ( ) ; opts . headers = opts . headers || { } ; var req = new ClientRequest$1 ( opts ) ; if ( cb ) req . on ( 'response' , cb ) ; return req }
this and http-lib folder
The MIT License
this and http - lib folder The MIT License
// Normally, the page is loaded from http or https, so not specifying a protocol // will result in a (valid) protocol-relative url. However, this won't work if // the protocol is something else, like 'file:' // Necessary for IPv6 addresses // This may be a relative url. The browser should always be able to interpret it correctly. // Also valid opts.auth, opts.mode