How to filter Fiddler traffic by request method?
Asked Answered
M

1

19

Fiddler is capturing a lot of HTTP OPTIONS calls, which I have no interest in.

Is it possible to ignore these and only see GET and POST?

Myrmeco answered 19/1, 2015 at 11:46 Comment(0)
M
39

In Fiddler, click "Rules" --> "Customize Rules". This will open a script file allowing you to create custom rules.

 

If you want to hide all OPTIONS requests

find OnBeforeRequest and add in this code:

static function OnBeforeRequest(oSession: Session) {
    if (oSession.HTTPMethodIs("OPTIONS")) {
       oSession["ui-hide"] = "true";
    }

 

Or alternatively, if you want to hide them only once they have returned 200

find OnBeforeResponse and add in this code:

static function OnBeforeResponse(oSession: Session) {
    if (oSession.HTTPMethodIs("OPTIONS") && oSession.responseCode == 200) {
       oSession["ui-hide"] = "true";
    }
Myrmeco answered 19/1, 2015 at 11:46 Comment(2)
I added a little to this with if (oSession.HTTPMethodIs("OPTIONS") && oSession.responseCode != 200) { oSession["ui-hide"] = "false"; } inside OnBeforeResponse so I can see the any strange option responses.Micropyle
@Micropyle I like that a lot. I've added something similar to my answer now, which I think is a slight improvement again. With this third version, if a OPTIONS call is slow & hanging then you will be able to see what is happening. (Rather then just empty window for 20 seconds before it finally errors.)Myrmeco

© 2022 - 2024 — McMap. All rights reserved.