response - Fiddler 2: Resend request through FiddlerScript -
hello stackoverflow folks,
i'm new fiddler 2, seem getting along pretty good. although have 1 problem can't seem solve.
what want simple think. want intercept request, let run, if response doesn't suit me want resend request , make initial request nonexcistent. using fiddlerscript.
why useful: in cases send request response different everytime. , want right kind of response.
what have far:
static function onbeforeresponse(osession: session) { if (osession.uricontains("/stackoverflowexample")) { if(osession.getrequestbodyasstring().contains("getrandomitem")) { if(osession.getresponsebodyasstring().tostring().contains("itemid")) { var body = osession.getresponsebodyasstring(); var item = 0; for(var = 0; i< body.length; i++) { if(i < body.length -7) { if(body.substring(i, 6) == "itemid") { item= convert.toint32(body.substring(i+7,1)); } } } messagebox.show(item.tostring()); if(item < 2536) //for example itemid must higher 2536 { //stop / make session nonexcistent //resend current request new response osession.state = sessionstates.sendingrequest; fiddlerobject.utilissuerequest(osession.orequest.tostring()); } } } } }
every possible solution using fiddlerscript welcome.
thank stackoverflow cummunity! (and fiddler developers)
setting state of session sendingrequest doesn't you'd hope.
here's example of sort of thing you're trying do. https://groups.google.com/forum/#!searchin/httpfiddler/retry/httpfiddler/3ozqvmqzdr0/uvqtyl3w2baj
if (!string.isnullorempty(osession["x-retrynumber"])) return; for(var iretry: int = 1; iretry < 5; ++iretry) { var osd = new system.collections.specialized.stringdictionary(); osd.add("x-retrynumber", iretry.tostring()); var newsession = fiddlerapplication.oproxy.sendrequestandwait(osession.orequest.headers, osession.requestbodybytes, osd, null); if (200 == newsession.responsecode) // <--- update whatever { // if successful on retry, bail here! osession.oresponse.headers = newsession.oresponse.headers; osession.responsebodybytes = newsession.responsebodybytes; osession.oresponse.headers["connection"] = "close"; // workaround limitation break; } }
Comments
Post a Comment