Skip to content

Commit c84e497

Browse files
Merge pull request #13 from matthew-andrews/node-fetch
Switch to node-fetch
2 parents 5cde7c9 + 87e8ea4 commit c84e497

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

.jshintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"node": true,
33
"browser": true,
4-
"predef": ["describe", "it", "before", "fetch"]
4+
"predef": ["describe", "it", "before"]
55
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
},
2020
"homepage": "https://github.com/matthew-andrews/node-fetch",
2121
"dependencies": {
22-
"whatwg-fetch": "matthew-andrews/fetch#ie9",
23-
"xmlhttprequest": "matthew-andrews/node-XMLHttpRequest"
22+
"node-fetch": "^1.0.1",
23+
"whatwg-fetch": "matthew-andrews/fetch#ie9"
2424
},
2525
"devDependencies": {
2626
"chai": "^1.10.0",

server.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
"use strict";
22

3-
global.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
4-
var noConflictSelf = global.self;
5-
global.self = {};
6-
require('whatwg-fetch');
7-
global.Headers = global.self.Headers;
8-
global.Request = global.self.Request;
9-
global.Response = global.self.Response;
10-
var realFetch = global.self.fetch;
3+
var realFetch = require('node-fetch');
114
module.exports = global.fetch = function(url, options) {
125
if (/^\/\//.test(url)) {
136
url = 'https:' + url;
147
}
158
return realFetch.call(this, url, options);
169
};
17-
global.self = noConflictSelf;

test/api.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*global fetch*/
12
"use strict";
23

34
require('es6-promise').polyfill();

0 commit comments

Comments
 (0)