fiddler脚本发送http请求

fiddler script send http request

我需要在 onBeforeResponse 方法中发送 http 请求。
我正在尝试在 CustomRules.js

中添加此方法

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

但是我有一个错误 "XMLHttpRequest" is not defined
有什么方法可以从 fiddler 脚本规则发送 http 请求?

Fiddler 没有浏览器对象模型,因此 XMLHttpRequest 未定义。幸运的是,它提供了许多不同的方式来发送 HTTP 请求;例如:

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