Faking it with Fiddler

So there are occasions when working with a third party services you need to be able to develop and test against various scenarios and respond differently based on the response from that service. Controlling the response can be a challenge sometimes with service being outside of your control.

Thankfully you can easily fake the response with tools like fiddler. Fiddler is an awesome tool and has been around forever and has always had a spot in my developer utility belt.

Filter out the noise

First thing you will want to do is to apply filter for the service/requests you are interested in, as fiddler monitors all web requests/responses. Doing this will help remove some of that noise and allow you to focus on the traffic you are really interested in. In the example below I have filtered out traffic for online payment provider paymetric.com.

Fake the Response with Auto Responder

Having filtered the traffic and identified the requests you would like to fake responses for, you can use Fiddlers built-in Auto Responder. Auto responder enables you to define rules and trigger responses to specific requests that match those rules, enabling you to craft your own responses and allows you to test how your application behaves under various conditions triggered by faked responses that you might receive from an external service.

Simply click on the AutoResponder tab and then define your rules and the response you would like to return when the request rule is matched.

The quickest way to create rules I have found is to drag a previously generated session over to the rules tab and then edit the response.

A few features to note

  • Rules are applied in the order they appear.
  • Rules can be exported and imported.
  • Fiddler can match string literals
  • Supports exact, case sensitive match syntax for expressions beginning with EXACT.
  • Fiddler supports regular expressions.

Useful Info

Happy Faking It!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s