user3911971
user3911971

Reputation: 131

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?

Upvotes: 1

Views: 1217

Answers (1)

EricLaw
EricLaw

Reputation: 57115

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

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

Upvotes: 3

Related Questions