Skip to content

Instantly share code, notes, and snippets.

@ironfroggy
Created October 19, 2014 14:01
Show Gist options
  • Select an option

  • Save ironfroggy/e87f1315b6300beece43 to your computer and use it in GitHub Desktop.

Select an option

Save ironfroggy/e87f1315b6300beece43 to your computer and use it in GitHub Desktop.
fetch('/users.json')
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('parsed json', json)
}).catch(function(ex) {
console.log('parsing failed', ex)
})
fetch('/users.json').then(function(response) {
console.log(response.headers.get('Content-Type'))
console.log(response.headers.get('Date'))
console.log(response.status)
console.log(response.statusText)
})
fetch('/query', {
method: 'post',
body: {
name: 'Hubot',
login: 'hubot'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment