3.0.0 • Published 8 years ago

portable-fetch v3.0.0

Weekly downloads
50,653
License
MIT
Repository
github
Last release
8 years ago

isomorphic-fetch Build Status

Fetch for node and Browserify. Also works in Webpack and React-Native Built on top of GitHub's WHATWG Fetch polyfill.

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.

For ease-of-maintenance and backward-compatibility reasons, this library will always be a polyfill. As a "safe" alternative, which does not modify the global, consider fetch-ponyfill.

Installation

NPM

npm install --save portable-fetch es6-promise

Usage

require('es6-promise').polyfill();
require('portable-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 jxck.

elice-api@bayamsell/rest-apicirkleapilibtactful-sdk@purplship/purplship@sudoplatform/sudo-di-cloud-agent@mniranjanmurthy/star-api-client@mniranjanmurthy/msp-api-clientqs-fe1@yotta/alloy-mapengage-call-api-js-sdkspeedcheck-typescript-clientprogram_leader_portal_py@everything-registry/sub-chunk-2458syncdogwire4-api-sdkwschmitt-test2service-api-clientstate_machine_aa_clientv1@buyborghi/openapi-js-client@bend-corp/md-editor-new@peregrinadev/bi@peregrinadev/chat@peregrinadev/core@peregrinadev/creditmanager@peregrinadev/notif@peregrinadev/query@peregrinadev/authdiscord-konstantin-api-clientk8s-web-clientidentity-network-api-sdki-magentogti-auth-ts-clienthere-route-matchinghallo-moebeltaxi-fetch-apilibrestapimantle-apimailslurp-swagger-sdk-ts-sravnirukubernetes-javascript-apimd-provider@tradingcentral/common-tradingview-plugins@vibeitco/api@uzmartech/planned-maintenance-client@vk-manager/api@voicify/voicify-sdk-analytics@voicify/voicify-sdk-assistant@voicify/voicify-sdk-cms@ybroeker/aware-adaptiveui-api@ybroeker/aware-webserver-apiawesomeflowerdispenserargo-libsargo-rolloutsargo-uxarlas-city-apiarlas-collection-apiarlas-subscriptions-apiarlas-idp-api@3wks/sargon-api-node-client@haras-pro-ui/client@eckdanny-osi/forms-api-client@edropin/accounts-ts-fetch@edropin/events-react@edropin/events-ts-fetch@edropin/store-ts-fetch@ale-de/ov_cirrus_rest_api@akron/scenario-microservice-ts-client@copromatic/datacopro-client@meeco/organisation-wallet-api-sdk@meeco/holder-wallet-api-sdkstx_nextworld_api_clientsquare-connect-tssteps-api-clienttimelight-ai-js-api-clienttrident-api-clientusls-ts-fetch@bitblit/saltmine@bitblit/paratrade-common@bjerkio/crayon-api@chirhos/chirhos-api-ts@cfl/autotagging-service@cfl/automatic-taxonomy-generator-serviceyalento-fullstackusda-fdc-api-typescript-client@mratsamy/fetch-redux-middleware@sargon/api-client@scillgame/scill-admin-js@scillgame/scill-jsoriginstamp-client-fetchopen_api_epsopen_api_ti_inquiryoldp-api-tsongoing_account_information__aispayping-fetch-clientrocksetportlet-builder-uipos-terminal-client-testsl-ts-fetch-sdkcall-api-swagger-client-sampledebut-api-servicedaltons
3.0.0

8 years ago

2.3.0

8 years ago