Skip to content

Instantly share code, notes, and snippets.

@jeremybarbet
Created November 11, 2019 23:30
Show Gist options
  • Select an option

  • Save jeremybarbet/6c2fc6ca3699b6eee0ad3fd8d9fa1728 to your computer and use it in GitHub Desktop.

Select an option

Save jeremybarbet/6c2fc6ca3699b6eee0ad3fd8d9fa1728 to your computer and use it in GitHub Desktop.
XMLHttpRequest = GLOBAL.originalXMLHttpRequest ?
GLOBAL.originalXMLHttpRequest :
GLOBAL.XMLHttpRequest;
// fetch logger
global._fetch = fetch;
global.fetch = function (uri, options, ...args) {
return global._fetch(uri, options, ...args).then((response) => {
console.log('Fetch', { request: { uri, options, ...args }, response });
return response;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment