简体   繁体   中英

fiddler script send http request

i need to send http request in onBeforeResponse method.
i am trying to add this method in CustomRules.js

 static function httpGet(theUrl){ var xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", theUrl, false ); xmlHttp.send( null ); return xmlHttp.responseText; } 

but i have an error "XMLHttpRequest" is not defined
There are any way how to send http request from fiddler script rule?

Fiddler doesn't have a browser object model, so XMLHttpRequest isn't defined. Fortunately, it offers many different ways to send HTTP requests; eg:

var oSD = new System.Collections.Specialized.StringDictionary();
var newSession = FiddlerApplication.oProxy.SendRequestAndWait(oSession.oRequest.headers, oSession.requestBodyBytes, oSD, null);
if (200 == newSession.responseCode)
{
 //....
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM