Last active
August 28, 2015 00:47
-
-
Save peterpme/6a7055fcb46281e51199 to your computer and use it in GitHub Desktop.
Expose your React Native network requests in Chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 function setUpXHR() { | |
104 // The native XMLHttpRequest in Chrome dev tools is CORS aware and won't | |
105 // let you fetch anything from the internet | |
106 GLOBAL.XMLHttpRequest = require('XMLHttpRequest'); // COMMENT OUT | |
107 GLOBAL.FormData = require('FormData'); // COMMENT OUT | |
108 | |
109 var fetchPolyfill = require('fetch'); // COMMENT OUT | |
110 GLOBAL.fetch = fetchPolyfill.fetch; // COMMENT OUT | |
111 GLOBAL.Headers = fetchPolyfill.Headers; // COMMENT OUT | |
112 GLOBAL.Request = fetchPolyfill.Request; // COMMENT OUT | |
113 GLOBAL.Response = fetchPolyfill.Response; // COMMENT OUT | |
114 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take care to revert this once you're ready for production