How can I ignore the first request for the same URL

1 Answer 35 Views
Fiddler Classic
Talha
Top achievements
Rank 1
Talha asked on 28 Dec 2023, 02:24 AM
How can I ignore the first request for the same URL with fiddler auto responder

I want auto responder to work with the 2nd request from the same url

1 Answer, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 28 Dec 2023, 07:39 AM

Hi Talha,

You cannot achieve your goal through the AutoResponder feature.

However, you can use FiddlerScript to add logic that checks whether the desired session is the first one that passes through the Fiddler proxy, based on your own criteria. Then, you can decide what to do with it, depending on whether it is the first occurrence or not.

For example, here is a basic demo that uses a boolean flag to determine if this is the first time we encounter a session that contains example.com in its URL (and blocks it from being executed succesfully).

static var isFirst = true;
static function OnBeforeRequest(oSession: Session) {
        if (oSession.uriContains("example.com")&& isFirst) {
            oSession.oRequest.FailSession(404, "Blocked", "Fiddler blocked request");
          
            isFirst = false; 
        }
}

 

 

Regards,
Nick Iliev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Talha
Top achievements
Rank 1
commented on 28 Dec 2023, 10:42 PM

thanks but what I wanted was not to block the first request
I want to apply auto responder to the 2nd request after the first request from the same url is successful and normal 
Nick Iliev
Telerik team
commented on 29 Dec 2023, 07:41 AM

You can use the same approach in FiddlerScript, but you need to switch the logic of the boolean statement. For instance, use the boolean flag to ensure that the first request occurs as it is, and then change the boolean flag so that you can apply custom actions on any subsequent requests that match the condition criteria.
Tags
Fiddler Classic
Asked by
Talha
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
Share this question
or