Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
sudo: false
language: node_js
node_js:
- "0.10"
- 4
- 6
- 8
- 9
before_deploy:
- npm-prepublish --verbose
deploy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
isomorphic-fetch [![Build Status](https://travis-ci.org/matthew-andrews/isomorphic-fetch.svg?branch=master)](https://travis-ci.org/matthew-andrews/isomorphic-fetch)
================

Fetch for node and Browserify. Built on top of [GitHub's WHATWG Fetch polyfill](https://github.com/github/fetch).
Fetch for node and Browserify. Built on top of [GitHub's WHATWG Fetch polyfill](https://github.com/github/fetch), via [fetch-ponyfill][].

## Warnings

Expand Down
6 changes: 0 additions & 6 deletions fetch-npm-browserify.js

This file was deleted.

10 changes: 5 additions & 5 deletions fetch-npm-node.js → index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use strict";

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

module.exports = process.browser ? realFetch.bind(global) : patchFetch;

if (!global.fetch) {
global.fetch = module.exports;
Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"name": "isomorphic-fetch",
"version": "0.0.0",
"description": "Isomorphic WHATWG Fetch API, for Node & Browserify",
"browser": "fetch-npm-browserify.js",
"main": "fetch-npm-node.js",
"scripts": {
"files": "find . -name '*.js' ! -path './node_modules/*' ! -path './bower_components/*'",
"test": "jshint `npm run -s files` && lintspaces -i js-comments -e .editorconfig `npm run -s files` && mocha"
Expand All @@ -19,16 +17,15 @@
},
"homepage": "https://github.com/matthew-andrews/isomorphic-fetch/issues",
"dependencies": {
"node-fetch": "^1.0.1",
"whatwg-fetch": ">=0.10.0"
"fetch-ponyfill": "^5.0.1"
},
"devDependencies": {
"chai": "^1.10.0",
"es6-promise": "^2.0.1",
"jshint": "^2.5.11",
"lintspaces-cli": "^0.1.1",
"mocha": "^2.1.0",
"nock": "^0.56.0",
"nock": "^9.1.6",
"npm-prepublish": "^1.0.2"
}
}
2 changes: 1 addition & 1 deletion test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"use strict";

require('es6-promise').polyfill();
require('../fetch-npm-node');
require('..');
var expect = require('chai').expect;
var nock = require('nock');
var good = 'hello world. 你好世界。';
Expand Down