Skip to content

Instantly share code, notes, and snippets.

@deanhume
Created August 19, 2015 10:48
Show Gist options
  • Save deanhume/f9a338d12aeb983b15be to your computer and use it in GitHub Desktop.
Save deanhume/f9a338d12aeb983b15be to your computer and use it in GitHub Desktop.

Revisions

  1. deanhume created this gist Aug 19, 2015.
    16 changes: 16 additions & 0 deletions fetch-api-post.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    fetch(url, {
    method: 'POST',
    headers: {
    'auth': '1234'
    },
    body: JSON.stringify({
    name: 'dean',
    login: 'dean',
    })
    })
    .then(function (data) {
    console.log('Request success: ', data);
    })
    .catch(function (error) {
    console.log('Request failure: ', error);
    });