Fiddler: How to Add a Http Verb, a SOAP Action and a Duration Column

Fiddler is a terrific and free web debugger for any browser, system or platform. You can see much information about every http request that is made. But even better, you can set breakpoints and tamper with the content of a request before continuing.

If you are doing web development, you need to know Fiddler. If you are starting web development, you should invest an hour or more to install and learn about Fiddler. It is a very good investment of your time.

How to Add a Http Verb Column

What I’ve missed from the beginning is a column which shows me the http method (POST, PROPFIND, GET, …) of a request. Many thanks to A. Mackert for the following solution:

In Fiddler, select Rules/Customize Rules. Notepad opens, with some predefined custom rule stuff. Scroll down unto class Handlers.
Uncommment the five marked lines and save the file.

CustomRules

If you have an older version, close and reopen Fiddler. Closing and reopeneing is not needed with the latest versions of Fiddler. Look for the new column – called Method at the right and drag it to the left. Voilá, you have a nice column with the http verb.

Fiddler-1

How to Change the Editor for the CustomRules File

If you want to do more changes than just uncommenting some lines, it is better to use another editor than notepad. To change the editor, go to Tools/Fiddler Options…/ Tools/FiddlerScriptEditor and select your preferred editor. Notepad++ will do well for now. For extended stuff, there is a special FiddlerScript Editor available. The FiddlerScript Editor has got a built in class explorer which helps with Fiddler classes and types.

How to Add a Column for the Duration of the Request

You can add a column which shows the time in seconds from start to end of a request.

With a current Fiddler version (I’m using 2.4.6.2) you must search for the class Handlers in the CustomRules-file and add the following snippet of code to the class:

public static BindUIColumn("Duration", 60)
function CalcDurationCol(oS: Session){
  var result = String.Empty;
  if ((oS.Timers.ServerDoneResponse > oS.Timers.ClientDoneRequest)) {
    var duration = oS.Timers.ServerDoneResponse -
           oS.Timers.ClientDoneRequest;
     result = String.Format("{0:0.0000}",
           duration.TotalMilliseconds/1000);
  }
  return result;
}

In some previous Fiddler version,   you could just search for m_ShowTTLB in the CustomRules-file and set the value to true.

How to Add a Column Containing the Start Time of the Request

In the CustomRules-file, in the class Handlers add the following snippet of code:

public static BindUIColumn("Starttime", 80)
function CalcStarttimeCol(oS: Session){
  var result = oS.Timers.ClientDoneRequest.ToString("HH:mm:ss.ff");
  return result;
}

The language used in the CustomRules.js is JScript.NET. So you can use all of .Net’s String.Format possibilities to format the output of the added columns.

How to Add a Column for the SOAP Action

I’ve copied this one from KorteAchternaam.

public static BindUIColumn("SOAP", 120)
function FillSoapAction(oS: Session) {
        if ((oS.oRequest != null)
                && (oS.oRequest.headers != null)
                && (oS.oRequest.headers.Exists("SOAPAction"))) {
            var action = oS.oRequest.headers.Item["SOAPAction"];
            return action.replace(/^.*\//, "").replace(/"/, "");
        } 
        else 
            return String.Empty;
}

Happy fiddling.

99 Developer Tools

Hello Everybody!

In this blog, I write about tools for software developers. I write about tools in a broad sense, including software, hardware, books, blogs, videos, philosophy, … in short, everything that makes me and you more successful as a developer.

I write about Tools with a big T… which means I write only about time-tested tools that I love, like and use myself. Which means also, you won’t find posts about the latest fad here. Only about stuff that’s really good. Or at least stuff of which I think it’s really good. I may be wrong sometimes. 😉 These tools may be old, years old; even decades old. Which are thousands of years, in internet time. It doesn’t matter to me. If they help me getting work done, I use them. Time-Tested Tools.

I hope to hear from you and your favourite tools.

Cheers,   Andreas