Fiddlercore Autorespond

Fiddler has the AutoResponder tab that allows you to replay a previously captured session.

Hosters of FiddlerCore can reproduce the behavior of this feature using code.

The following snippet looks for requests for replaceme.txt and returns a previously captured response stored in a session object named SessionIWantToReturn.

Fiddler.FiddlerApplication.BeforeRequest += delegate(Fiddler.Session oS)
    if (oSession.HTTPMethodIs("CONNECT")) { oSession.oFlags["X-ReplyWithTunnel"] = "Fake for HTTPS Tunnel"; return; }
    if (oS.uriContains("replaceme.txt"))
        oS.responseBodyBytes = SessionIWantToReturn.responseBodyBytes;
        oS.oResponse.headers = (HTTPResponseHeaders) SessionIWantToReturn.oResponse.headers.Clone();
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License