Last active
November 5, 2021 16:19
-
-
Save neodigm/65bbc27ab38ae0128da04fbfd9282393 to your computer and use it in GitHub Desktop.
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
var RealXMLHttpRequest = window.XMLHttpRequest; | |
window.XMLHttpRequest = function(){ | |
var asynchrony = new RealXMLHttpRequest(); | |
var realOpen = asynchrony.open; | |
// steal the OPEN method | Has to be open to send header | |
asynchrony.open = function(method, url){ | |
realOpen.apply(asynchrony, arguments); | |
asynchrony.setRequestHeader('X-Custom', 'customtext'); | |
}; | |
return asynchrony; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment