cross-fetch playground

Open your browser console and run this code:

fetch('package.json')
  .then(function(res) {
    if (res.status >= 400) {
      throw new Error("Bad response from server");
    }
    return res.json();
  }).then(function(pkg) {
    console.log('Success: cross-fetch '+pkg.version+', '+pkg.description+'!');
  }).catch(function(err) {
    console.log('Error: '+err.message);
  });
    
* this box is editable, make your changes and click the "Run Code" button.
** checkout the Github's fetch api page for more options.