Skip to content

Instantly share code, notes, and snippets.

@andruxnet
Created April 25, 2017 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andruxnet/e20c6f4a436bce5095dcad89257576fd to your computer and use it in GitHub Desktop.
Save andruxnet/e20c6f4a436bce5095dcad89257576fd to your computer and use it in GitHub Desktop.
function getQuote() {
return fetch('https://andruxnet-random-famous-quotes.p.mashape.com/?cat=famous', {
method: POST,
headers: {
"X-Mashape-Key": "b6tCZGODOTmshRX3SGwKX39eANfup1NqESSjsnPp9aB0mxbvHF",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
}
})
.then(blob => {
console.log(blob);
return blob.json
})
.then((response) => {
console.log(response); // so that I can see the response - looks like response.body is where the quote would be
return handleResponse(response)
})
.catch((error) => {
return handleError(error);
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment