Search code examples
fiddlerjscriptfiddlercorefiddler-dev

Reapeat/replay a session x times with a different request header


is it possible to reapeat/replay a session x times with a different reaquest header.

I was thinking of a for loop inside OnBeforeRequest which will iterate over the same request from the session, but with a different parameter for the request header ...

But I am kind of lost, can you help me?


Solution

  •     for (var i=0; i< 50; i++)
        {      
            var oSD = new System.Collections.Specialized.StringDictionary();
            oSD.Add("x-Builder-MaxRedir", "10");
            var oRH: Fiddler.HTTPRequestHeaders = new Fiddler.HTTPRequestHeaders();
    
            var oURI: System.Uri = new Uri("https://whatever.com/" + i.ToString());
    
            var sHeaders: String = String.Format("GET {0} HTTP/1.1\r\nHost: {1}\r\n\r\n", oURI.PathAndQuery, oURI.Host);
      // ^^^ Add any header you like here, then...
            oRH.AssignFromString(sHeaders);          
            var newSession = FiddlerApplication.oProxy.SendRequest(oRH, null, oSD);
    
        }