aboutsummaryrefslogtreecommitdiff
path: root/node_modules/isomorphic-fetch
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
commitde98e0b232509d5f40c135d540a70e415272ff85 (patch)
treea79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/isomorphic-fetch
parente0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff)
downloadwallet-core-de98e0b232509d5f40c135d540a70e415272ff85.tar.xz
node_modules
Diffstat (limited to 'node_modules/isomorphic-fetch')
-rw-r--r--node_modules/isomorphic-fetch/.editorconfig12
-rw-r--r--node_modules/isomorphic-fetch/.jshintrc5
-rw-r--r--node_modules/isomorphic-fetch/.npmignore2
-rw-r--r--node_modules/isomorphic-fetch/.travis.yml15
-rw-r--r--node_modules/isomorphic-fetch/LICENSE21
-rw-r--r--node_modules/isomorphic-fetch/README.md45
-rw-r--r--node_modules/isomorphic-fetch/bower.json7
-rw-r--r--node_modules/isomorphic-fetch/fetch-bower.js1
-rw-r--r--node_modules/isomorphic-fetch/fetch-npm-browserify.js6
-rw-r--r--node_modules/isomorphic-fetch/fetch-npm-node.js16
-rw-r--r--node_modules/isomorphic-fetch/package.json34
-rw-r--r--node_modules/isomorphic-fetch/test/api.test.js51
12 files changed, 215 insertions, 0 deletions
diff --git a/node_modules/isomorphic-fetch/.editorconfig b/node_modules/isomorphic-fetch/.editorconfig
new file mode 100644
index 000000000..7bfa0f2d7
--- /dev/null
+++ b/node_modules/isomorphic-fetch/.editorconfig
@@ -0,0 +1,12 @@
+root=true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+
+[*.js]
+indent_style = tab
+
+[*.json]
+indent_style = space
+indent_size = 2
diff --git a/node_modules/isomorphic-fetch/.jshintrc b/node_modules/isomorphic-fetch/.jshintrc
new file mode 100644
index 000000000..3686db75a
--- /dev/null
+++ b/node_modules/isomorphic-fetch/.jshintrc
@@ -0,0 +1,5 @@
+{
+ "node": true,
+ "browser": true,
+ "predef": ["describe", "it", "before"]
+}
diff --git a/node_modules/isomorphic-fetch/.npmignore b/node_modules/isomorphic-fetch/.npmignore
new file mode 100644
index 000000000..5bbff155f
--- /dev/null
+++ b/node_modules/isomorphic-fetch/.npmignore
@@ -0,0 +1,2 @@
+/node_modules/
+/bower_components/
diff --git a/node_modules/isomorphic-fetch/.travis.yml b/node_modules/isomorphic-fetch/.travis.yml
new file mode 100644
index 000000000..225affa5f
--- /dev/null
+++ b/node_modules/isomorphic-fetch/.travis.yml
@@ -0,0 +1,15 @@
+sudo: false
+language: node_js
+node_js:
+ - "0.10"
+before_deploy:
+ - npm-prepublish --verbose
+deploy:
+ provider: npm
+ email: matt@mattandre.ws
+ api_key:
+ secure: eEeb1aG7phF4X5z+CQ3yzTdXtHf71Dk4ec6v5iAjRYNh/s6GLxfZS7c4qocZI8YXW3YmmsJR5zGZ2l88k2iqTtlBn0Mrp6ytwIa/jO00kDpR8V11eW9i47KRQq25eA1YW+SrLM5V/fh+s9u3VU7jhbax5eeViqVdwORI85kZrZE=
+ on:
+ all_branches: true
+ tags: true
+ repo: matthew-andrews/isomorphic-fetch
diff --git a/node_modules/isomorphic-fetch/LICENSE b/node_modules/isomorphic-fetch/LICENSE
new file mode 100644
index 000000000..2385aa966
--- /dev/null
+++ b/node_modules/isomorphic-fetch/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Matt Andrews
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/isomorphic-fetch/README.md b/node_modules/isomorphic-fetch/README.md
new file mode 100644
index 000000000..270a3e396
--- /dev/null
+++ b/node_modules/isomorphic-fetch/README.md
@@ -0,0 +1,45 @@
+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).
+
+## Warnings
+
+- This adds `fetch` as a global so that its API is consistent between client and server.
+- You must bring your own ES6 Promise compatible polyfill, I suggest [es6-promise](https://github.com/jakearchibald/es6-promise).
+
+## Installation
+
+### NPM
+
+```sh
+npm install --save isomorphic-fetch es6-promise
+```
+
+### Bower
+
+```sh
+bower install --save isomorphic-fetch es6-promise
+```
+
+## Usage
+
+```js
+require('es6-promise').polyfill();
+require('isomorphic-fetch');
+
+fetch('//offline-news-api.herokuapp.com/stories')
+ .then(function(response) {
+ if (response.status >= 400) {
+ throw new Error("Bad response from server");
+ }
+ return response.json();
+ })
+ .then(function(stories) {
+ console.log(stories);
+ });
+```
+
+## License
+
+All open source code released by FT Labs is licenced under the MIT licence. Based on [the fine work by](https://github.com/github/fetch/pull/31) **[jxck](https://github.com/Jxck)**.
diff --git a/node_modules/isomorphic-fetch/bower.json b/node_modules/isomorphic-fetch/bower.json
new file mode 100644
index 000000000..dcefb046e
--- /dev/null
+++ b/node_modules/isomorphic-fetch/bower.json
@@ -0,0 +1,7 @@
+{
+ "name": "isomorphic-fetch",
+ "main": ["fetch-bower.js"],
+ "dependencies": {
+ "fetch": "github/fetch#>=0.10.0"
+ }
+}
diff --git a/node_modules/isomorphic-fetch/fetch-bower.js b/node_modules/isomorphic-fetch/fetch-bower.js
new file mode 100644
index 000000000..557a2fe43
--- /dev/null
+++ b/node_modules/isomorphic-fetch/fetch-bower.js
@@ -0,0 +1 @@
+module.exports = require('fetch');
diff --git a/node_modules/isomorphic-fetch/fetch-npm-browserify.js b/node_modules/isomorphic-fetch/fetch-npm-browserify.js
new file mode 100644
index 000000000..7f16e2319
--- /dev/null
+++ b/node_modules/isomorphic-fetch/fetch-npm-browserify.js
@@ -0,0 +1,6 @@
+// the whatwg-fetch polyfill installs the fetch() function
+// on the global object (window or self)
+//
+// Return that as the export for use in Webpack, Browserify etc.
+require('whatwg-fetch');
+module.exports = self.fetch.bind(self);
diff --git a/node_modules/isomorphic-fetch/fetch-npm-node.js b/node_modules/isomorphic-fetch/fetch-npm-node.js
new file mode 100644
index 000000000..bbd3dd1da
--- /dev/null
+++ b/node_modules/isomorphic-fetch/fetch-npm-node.js
@@ -0,0 +1,16 @@
+"use strict";
+
+var realFetch = require('node-fetch');
+module.exports = function(url, options) {
+ if (/^\/\//.test(url)) {
+ url = 'https:' + url;
+ }
+ return realFetch.call(this, url, options);
+};
+
+if (!global.fetch) {
+ global.fetch = module.exports;
+ global.Response = realFetch.Response;
+ global.Headers = realFetch.Headers;
+ global.Request = realFetch.Request;
+}
diff --git a/node_modules/isomorphic-fetch/package.json b/node_modules/isomorphic-fetch/package.json
new file mode 100644
index 000000000..85196b125
--- /dev/null
+++ b/node_modules/isomorphic-fetch/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "isomorphic-fetch",
+ "version": "2.2.1",
+ "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"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/matthew-andrews/isomorphic-fetch.git"
+ },
+ "author": "Matt Andrews <matt@mattandre.ws>",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/matthew-andrews/isomorphic-fetch/issues"
+ },
+ "homepage": "https://github.com/matthew-andrews/isomorphic-fetch/issues",
+ "dependencies": {
+ "node-fetch": "^1.0.1",
+ "whatwg-fetch": ">=0.10.0"
+ },
+ "devDependencies": {
+ "chai": "^1.10.0",
+ "es6-promise": "^2.0.1",
+ "jshint": "^2.5.11",
+ "lintspaces-cli": "0.0.4",
+ "mocha": "^2.1.0",
+ "nock": "^0.56.0",
+ "npm-prepublish": "^1.0.2"
+ }
+}
diff --git a/node_modules/isomorphic-fetch/test/api.test.js b/node_modules/isomorphic-fetch/test/api.test.js
new file mode 100644
index 000000000..c25a5cbe8
--- /dev/null
+++ b/node_modules/isomorphic-fetch/test/api.test.js
@@ -0,0 +1,51 @@
+/*global fetch*/
+"use strict";
+
+require('es6-promise').polyfill();
+require('../fetch-npm-node');
+var expect = require('chai').expect;
+var nock = require('nock');
+var good = 'hello world. 你好世界。';
+var bad = 'good bye cruel world. 再见残酷的世界。';
+
+function responseToText(response) {
+ if (response.status >= 400) throw new Error("Bad server response");
+ return response.text();
+}
+
+describe('fetch', function() {
+
+ before(function() {
+ nock('https://mattandre.ws')
+ .get('/succeed.txt')
+ .reply(200, good);
+ nock('https://mattandre.ws')
+ .get('/fail.txt')
+ .reply(404, bad);
+ });
+
+ it('should be defined', function() {
+ expect(fetch).to.be.a('function');
+ });
+
+ it('should facilitate the making of requests', function(done) {
+ fetch('//mattandre.ws/succeed.txt')
+ .then(responseToText)
+ .then(function(data) {
+ expect(data).to.equal(good);
+ done();
+ })
+ .catch(done);
+ });
+
+ it('should do the right thing with bad requests', function(done) {
+ fetch('//mattandre.ws/fail.txt')
+ .then(responseToText)
+ .catch(function(err) {
+ expect(err.toString()).to.equal("Error: Bad server response");
+ done();
+ })
+ .catch(done);
+ });
+
+});