GT2/GT2-Android/node_modules/whatwg-fetch/package.json

97 lines
11 KiB
JSON

{
"_args": [
[
{
"raw": "whatwg-fetch@>=0.10.0",
"scope": null,
"escapedName": "whatwg-fetch",
"name": "whatwg-fetch",
"rawSpec": ">=0.10.0",
"spec": ">=0.10.0",
"type": "range"
},
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/isomorphic-fetch"
]
],
"_from": "whatwg-fetch@>=0.10.0",
"_id": "whatwg-fetch@2.0.3",
"_inCache": true,
"_location": "/whatwg-fetch",
"_nodeVersion": "0.10.48",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/whatwg-fetch-2.0.3.tgz_1488476993688_0.31996091664768755"
},
"_npmUser": {
"name": "mislav",
"email": "mislav.marohnic@gmail.com"
},
"_npmVersion": "2.15.1",
"_phantomChildren": {},
"_requested": {
"raw": "whatwg-fetch@>=0.10.0",
"scope": null,
"escapedName": "whatwg-fetch",
"name": "whatwg-fetch",
"rawSpec": ">=0.10.0",
"spec": ">=0.10.0",
"type": "range"
},
"_requiredBy": [
"/isomorphic-fetch"
],
"_resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz",
"_shasum": "9c84ec2dcf68187ff00bc64e1274b442176e1c84",
"_shrinkwrap": null,
"_spec": "whatwg-fetch@>=0.10.0",
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/isomorphic-fetch",
"bugs": {
"url": "https://github.com/github/fetch/issues"
},
"dependencies": {},
"description": "A window.fetch polyfill.",
"devDependencies": {
"chai": "1.10.0",
"jshint": "2.8.0",
"mocha": "2.1.0",
"mocha-phantomjs-core": "2.0.1",
"promise-polyfill": "6.0.2",
"url-search-params": "0.6.1"
},
"directories": {},
"dist": {
"shasum": "9c84ec2dcf68187ff00bc64e1274b442176e1c84",
"tarball": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz"
},
"files": [
"LICENSE",
"fetch.js"
],
"gitHead": "d4ed806fdcbdeaef707d27f6c88943f0336a647d",
"homepage": "https://github.com/github/fetch#readme",
"license": "MIT",
"main": "fetch.js",
"maintainers": [
{
"name": "mattandrews",
"email": "matt@mattandre.ws"
},
{
"name": "mislav",
"email": "mislav.marohnic@gmail.com"
}
],
"name": "whatwg-fetch",
"optionalDependencies": {},
"readme": "# window.fetch polyfill\n\nThe `fetch()` function is a Promise-based mechanism for programmatically making\nweb requests in the browser. This project is a polyfill that implements a subset\nof the standard [Fetch specification][], enough to make `fetch` a viable\nreplacement for most uses of XMLHttpRequest in traditional web applications.\n\nThis project adheres to the [Open Code of Conduct][]. By participating, you are\nexpected to uphold this code.\n\n## Table of Contents\n\n* [Read this first](#read-this-first)\n* [Installation](#installation)\n* [Usage](#usage)\n * [HTML](#html)\n * [JSON](#json)\n * [Response metadata](#response-metadata)\n * [Post form](#post-form)\n * [Post JSON](#post-json)\n * [File upload](#file-upload)\n * [Caveats](#caveats)\n * [Handling HTTP error statuses](#handling-http-error-statuses)\n * [Sending cookies](#sending-cookies)\n * [Receiving cookies](#receiving-cookies)\n * [Obtaining the Response URL](#obtaining-the-response-url)\n* [Browser Support](#browser-support)\n\n## Read this first\n\n* If you believe you found a bug with how `fetch` behaves in Chrome or Firefox,\n please **avoid opening an issue in this repository**. This project is a\n _polyfill_, and since Chrome and Firefox both implement the `window.fetch`\n function natively, no code from this project actually takes any effect in\n these browsers. See [Browser support](#browser-support) for detailed\n information.\n\n* If you have trouble **making a request to another domain** (a different\n subdomain or port number also constitutes as another domain), please\n familiarize yourself with all the intricacies and limitations of [CORS][]\n requests. Because CORS requires participation of the server by implementing\n specific HTTP response headers, it is often nontrivial to set up or debug.\n CORS is exclusively handled by the browser's internal mechanisms which this\n polyfill cannot influence.\n\n* If you have trouble **maintaining the user's session** or [CSRF][] protection\n through `fetch` requests, please ensure that you've read and understood the\n [Sending cookies](#sending-cookies) section.\n\n* If this polyfill **doesn't work under Node.js environments**, that is expected,\n because this project is meant for web browsers only. You should ensure that your\n application doesn't try to package and run this on the server.\n\n* If you have an idea for a new feature of `fetch`, please understand that we\n are only ever going to add features and APIs that are a part of the\n [Fetch specification][]. You should **submit your feature requests** to the\n [repository of the specification](https://github.com/whatwg/fetch/issues)\n itself, rather than this repository.\n\n## Installation\n\n* `npm install whatwg-fetch --save`; or\n\n* `bower install fetch`.\n\nYou will also need a Promise polyfill for [older browsers](http://caniuse.com/#feat=promises).\nWe recommend [taylorhakes/promise-polyfill](https://github.com/taylorhakes/promise-polyfill)\nfor its small size and Promises/A+ compatibility.\n\nFor use with webpack, add this package in the `entry` configuration option\nbefore your application entry point:\n\n```javascript\nentry: ['whatwg-fetch', ...]\n```\n\nFor Babel and ES2015+, make sure to import the file:\n\n```javascript\nimport 'whatwg-fetch'\n```\n\n## Usage\n\nFor a more comprehensive API reference that this polyfill supports, refer to\nhttps://github.github.io/fetch/.\n\n### HTML\n\n```javascript\nfetch('/users.html')\n .then(function(response) {\n return response.text()\n }).then(function(body) {\n document.body.innerHTML = body\n })\n```\n\n### JSON\n\n```javascript\nfetch('/users.json')\n .then(function(response) {\n return response.json()\n }).then(function(json) {\n console.log('parsed json', json)\n }).catch(function(ex) {\n console.log('parsing failed', ex)\n })\n```\n\n### Response metadata\n\n```javascript\nfetch('/users.json').then(function(response) {\n console.log(response.headers.get('Content-Type'))\n console.log(response.headers.get('Date'))\n console.log(response.status)\n console.log(response.statusText)\n})\n```\n\n### Post form\n\n```javascript\nvar form = document.querySelector('form')\n\nfetch('/users', {\n method: 'POST',\n body: new FormData(form)\n})\n```\n\n### Post JSON\n\n```javascript\nfetch('/users', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n name: 'Hubot',\n login: 'hubot',\n })\n})\n```\n\n### File upload\n\n```javascript\nvar input = document.querySelector('input[type=\"file\"]')\n\nvar data = new FormData()\ndata.append('file', input.files[0])\ndata.append('user', 'hubot')\n\nfetch('/avatars', {\n method: 'POST',\n body: data\n})\n```\n\n### Caveats\n\nThe `fetch` specification differs from `jQuery.ajax()` in mainly two ways that\nbear keeping in mind:\n\n* The Promise returned from `fetch()` **won't reject on HTTP error status**\n even if the response is an HTTP 404 or 500. Instead, it will resolve normally,\n and it will only reject on network failure or if anything prevented the\n request from completing.\n\n* By default, `fetch` **won't send or receive any cookies** from the server,\n resulting in unauthenticated requests if the site relies on maintaining a user\n session. See [Sending cookies](#sending-cookies) for how to opt into cookie\n handling.\n\n#### Handling HTTP error statuses\n\nTo have `fetch` Promise reject on HTTP error statuses, i.e. on any non-2xx\nstatus, define a custom response handler:\n\n```javascript\nfunction checkStatus(response) {\n if (response.status >= 200 && response.status < 300) {\n return response\n } else {\n var error = new Error(response.statusText)\n error.response = response\n throw error\n }\n}\n\nfunction parseJSON(response) {\n return response.json()\n}\n\nfetch('/users')\n .then(checkStatus)\n .then(parseJSON)\n .then(function(data) {\n console.log('request succeeded with JSON response', data)\n }).catch(function(error) {\n console.log('request failed', error)\n })\n```\n\n#### Sending cookies\n\nTo automatically send cookies for the current domain, the `credentials` option\nmust be provided:\n\n```javascript\nfetch('/users', {\n credentials: 'same-origin'\n})\n```\n\nThe \"same-origin\" value makes `fetch` behave similarly to XMLHttpRequest with\nregards to cookies. Otherwise, cookies won't get sent, resulting in these\nrequests not preserving the authentication session.\n\nFor [CORS][] requests, use the \"include\" value to allow sending credentials to\nother domains:\n\n```javascript\nfetch('https://example.com:1234/users', {\n credentials: 'include'\n})\n```\n\n#### Receiving cookies\n\nAs with XMLHttpRequest, the `Set-Cookie` response header returned from the\nserver is a [forbidden header name][] and therefore can't be programmatically\nread with `response.headers.get()`. Instead, it's the browser's responsibility\nto handle new cookies being set (if applicable to the current URL). Unless they\nare HTTP-only, new cookies will be available through `document.cookie`.\n\nBear in mind that the default behavior of `fetch` is to ignore the `Set-Cookie`\nheader completely. To opt into accepting cookies from the server, you must use\nthe `credentials` option.\n\n#### Obtaining the Response URL\n\nDue to limitations of XMLHttpRequest, the `response.url` value might not be\nreliable after HTTP redirects on older browsers.\n\nThe solution is to configure the server to set the response HTTP header\n`X-Request-URL` to the current URL after any redirect that might have happened.\nIt should be safe to set it unconditionally.\n\n``` ruby\n# Ruby on Rails controller example\nresponse.headers['X-Request-URL'] = request.url\n```\n\nThis server workaround is necessary if you need reliable `response.url` in\nFirefox < 32, Chrome < 37, Safari, or IE.\n\n## Browser Support\n\n- Chrome\n- Firefox\n- Safari 6.1+\n- Internet Explorer 10+\n\nNote: modern browsers such as Chrome, Firefox, and Microsoft Edge contain native\nimplementations of `window.fetch`, therefore the code from this polyfill doesn't\nhave any effect on those browsers. If you believe you've encountered an error\nwith how `window.fetch` is implemented in any of these browsers, you should file\nan issue with that browser vendor instead of this project.\n\n\n [fetch specification]: https://fetch.spec.whatwg.org\n [open code of conduct]: http://todogroup.org/opencodeofconduct/#fetch/opensource@github.com\n [cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS\n \"Cross-origin resource sharing\"\n [csrf]: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet\n \"Cross-site request forgery\"\n [forbidden header name]: https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/github/fetch.git"
},
"scripts": {
"test": "make"
},
"version": "2.0.3"
}