What is $httpProvider.defaults.headers.common in native JavaScript syntax -
how set common request header using javascript every single http call client side?
i don't think there native support this. on other hand can extend xmlhttprequest class passes custom header , override existing xmlhttprequest in window.
take @ answer : https://stackoverflow.com/a/9701050
sample:
!(send){ xmlhttprequest.prototype.send = function (data) { this.setrequestheader("x-requested-with", "xmlhttprequest"); // set header here send.call(this, data); } }(xmlhttprequest.prototype.send);
Comments
Post a Comment