Skip to content

Commit

Permalink
Merge pull request #18 from matthew-andrews/dont-force-fetch
Browse files Browse the repository at this point in the history
Don't redefine global fetch.
  • Loading branch information
matthew-andrews committed Apr 15, 2015
2 parents 1bb628e + 6ce72e7 commit 605153f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"use strict";

var realFetch = require('node-fetch');
module.exports = global.fetch = function(url, options) {
module.exports = function(url, options) {
if (/^\/\//.test(url)) {
url = 'https:' + url;
}
return realFetch.call(this, url, options);
};

if (!global.fetch) {
global.fetch = module.exports;
}

0 comments on commit 605153f

Please sign in to comment.