fetch-npm-node.js 365 B

12345678910111213141516
  1. "use strict";
  2. var realFetch = require('node-fetch');
  3. module.exports = function(url, options) {
  4. if (/^\/\//.test(url)) {
  5. url = 'https:' + url;
  6. }
  7. return realFetch.call(this, url, options);
  8. };
  9. if (!global.fetch) {
  10. global.fetch = module.exports;
  11. global.Response = realFetch.Response;
  12. global.Headers = realFetch.Headers;
  13. global.Request = realFetch.Request;
  14. }