Skip to content

Commit

Permalink
Merge pull request #13 from matthew-andrews/node-fetch
Browse files Browse the repository at this point in the history
Switch to node-fetch
  • Loading branch information
matthew-andrews committed Feb 10, 2015
2 parents 5cde7c9 + 87e8ea4 commit c84e497
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
@@ -1,5 +1,5 @@
{
"node": true,
"browser": true,
"predef": ["describe", "it", "before", "fetch"]
"predef": ["describe", "it", "before"]
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -19,8 +19,8 @@
},
"homepage": "https://github.com/matthew-andrews/node-fetch",
"dependencies": {
"whatwg-fetch": "matthew-andrews/fetch#ie9",
"xmlhttprequest": "matthew-andrews/node-XMLHttpRequest"
"node-fetch": "^1.0.1",
"whatwg-fetch": "matthew-andrews/fetch#ie9"
},
"devDependencies": {
"chai": "^1.10.0",
Expand Down
10 changes: 1 addition & 9 deletions server.js
@@ -1,17 +1,9 @@
"use strict";

global.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
var noConflictSelf = global.self;
global.self = {};
require('whatwg-fetch');
global.Headers = global.self.Headers;
global.Request = global.self.Request;
global.Response = global.self.Response;
var realFetch = global.self.fetch;
var realFetch = require('node-fetch');
module.exports = global.fetch = function(url, options) {
if (/^\/\//.test(url)) {
url = 'https:' + url;
}
return realFetch.call(this, url, options);
};
global.self = noConflictSelf;
1 change: 1 addition & 0 deletions test/api.test.js
@@ -1,3 +1,4 @@
/*global fetch*/
"use strict";

require('es6-promise').polyfill();
Expand Down

0 comments on commit c84e497

Please sign in to comment.