Fetch API test
JavaScript
// https://developers.google.com/web/updates/2015/03/introduction-to-fetch?hl=en
function _settleStream(stream) {
if (stream.status < 300) return Promise.resolve(stream);
return Promise.reject(new Error(stream.statusText));
}
function _parseRsp(rsp) {
return rsp.json();
}
function _rspSuccess(data) {
console.log(data);
}
function _rspError(reason) {
console.log(reason);
}
fetch('https://staging.paytm.com/v1/api/footerdata ')
.then(_settleStream)
.then(_parseRsp)
.then(_rspSuccess)
.catch(_rspError);