🐕 Bare minimum 500b fetch polyfill.
Full Changelog: https://github.com/developit/unfetch/compare/isomorphic-4.0.1...isomorphic-4.0.2
Full Changelog: https://github.com/developit/unfetch/compare/4.2.0...5.0.0
Full Changelog: https://github.com/developit/unfetch/compare/isomorphic-3.1.0...isomorphic-4.0.1
.json()
parse errors return a rejected Promise instead of throwing (#112, thanks @sunsean!)
URL
objects to fetch()
(#141, thanks @Edorka for the tip!)
Please make sure to also update to
[email protected]
, which includes a security fix fornode-fetch
. (thanks @sakito21)
Quick publishing fix.
🦄 Small breaking change for awesome ponyness:
unfetch
is now a pure ponyfill.unfetch/polyfill
is now the polyfill version (even smaller than the ponyfill!)TL;DR:
require('unfetch')
no longer returnswindow.fetch
when it exists. For that, useunfetch/polyfill
.
This change makes unfetch lovely to use as a polyfill from HTML:
<script src="https://unpkg.com/unfetch/polyfill"></script>
<!-- that's it! -->
<script>foo = await fetch('/foo.json')</script>
Otherwise, if you're using Unfetch and bundling your code, continue as you were before:
if (!self.fetch) self.fetch = require('unfetch');
// or simply:
import 'unfetch/polyfill';
Important - the one thing to avoid:
Since unfetch is a proper ponyfill, it will now overwrite
fetch
even in supported browsers if you do the following// never do this! window.fetch = require('unfetch');
[email protected]
/ [email protected]
. Thanks @schonert & @wereHamster.Also released:
[email protected]
- now with node-fetch 2.x, TypeScript definitions and a readme.