I have the following function which I can not override:
getHtml:function(aURL,aPostData,aHeaders,aMethod){
this.xhr = new XMLHttpRequest();
var tmp=this;
this.xhr.onreadystatechange=function(){
tmp.onStateChange();
};
if(aPostData||aPostData==""){
this.xhr.open(aMethod?aMethod:"POST", aURL, true);
this.xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}else this.xhr.open(aMethod?aMethod:"GET", aURL, true);
if(aHeaders){
for(var t in aHeaders){
this.xhr.setRequestHeader(t,aHeaders[t]);
}
}
try{
this.xhr.send(aPostData);
}catch(e){
this.doNext("");
}
}
How should I pass several headers (aHeaders
) to this function? If I pass Content-Type
as the header, will it override default value (application/x-www-form-urlencoded
) there?
I would like to pass two headers:
x-myheader-value
:zzz1111bbb
content-type
:application/javascript