This is a migrated thread and some comments may be shown as answers.

AutoRepsonse Fiddler only for GET

3 Answers 864 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 08 Apr 2015, 12:10 PM

Hey,

 

in Fiddler 1 it was possible to add "Filters" in order to replace stuff in Requests / Responses. Sadly Fiddler 2 use a weird Script Tool now, which is not more "Noob Friendly"

 So I tried AutoRepsonse. Sadly AutoRepsonse respond to all of the REquest Matching this. But for me it it is like:

 

HEAD /quest here/

GET /here he get the actual XML File/

HEAD /

 

So I want, that he only respond at GET (a Local File or a modded one)

 

What I real want is, modify a XML Response.

 

< file="/url/" version="50150"> I want:   remove "Version=50150"  so it looks like : <file="/url/">

3 Answers, 1 is accepted

Sort by
0
Eric Lawrence
Telerik team
answered on 08 Apr 2015, 02:32 PM
Hello, Robert--

I think you're confused; the functionality in Fiddler2 is a strict superset of the functionality in Fiddler1 which was discontinued over half a decade ago.

There are many ways to change responses; you're right that the script engine is the most common way to do so. You're also correct to note that the AutoResponder is a great way to return modified or generated responses.

If you want to use the AutoResponder, simply ensure that the Matching Text correctly matches the exact URL whose content you're trying to return. Unfortunately, your examples below are fake so I can't tell you exactly what to use, but your rule should probably look like:

   EXACT:http://www.example.com/myfile.xml

If a HEAD request is made that matches that rule, Fiddler's AutoResponder will handle this correctly and return only the HTTP headers from the response, as required by the HTTP specification.

If you have a scenario where you need only one method to match (e.g. if a given URL is retrieved with different results using both HEAD and POST) you can specify a method qualifier:

   METHOD: GET http://www.example.com/myfile.xml

If you decide you don't want to use the AutoResponder, you can easily make modifications with script as shown in the "Search and replace in HTML" section here: http://docs.telerik.com/fiddler/KnowledgeBase/FiddlerScript/ModifyRequestOrResponse

Best wishes,
Eric Lawrence
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Robert
Top achievements
Rank 1
answered on 13 Apr 2015, 04:00 PM

Got it working with Script Editor, amazing!

 

PS: Can I do some like "Only Response to the 5. Request or to the 3 and 5. Request?"

0
Eric Lawrence
Telerik team
answered on 13 Apr 2015, 05:46 PM
Hello, Robert--

I'm not sure what you mean when you say "to the 5. Request or to the 3 and 5. Request?"

If you're asking: "Can FiddlerScript look at the Session's ID property" the answer is "Yes, of course." It's the oSession.id.

If you're asking: "Can FiddlerScript count requests of a given URL and thus track how many times a given URL has been requested" the answer is "Yes, of course, it's a full script engine, and you can create a local variable in the Handlers class like

   var iTimesAsked = 0;

and then inside OnBeforeRequest you can do, e.g.

   if (oSession.fullUrl == "https://whatever/whatever.html") {iTimesAsked++;}

etc.

If you're asking: "Can Fiddler's AutoResponder have multiple replies for a single URL such that they can be played back "in order", the answer is "Yes." Create multiple replies for the URL, and for each of them, tick the "Match only once" checkbox.


Regards,
Eric Lawrence
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Fiddler Classic
Asked by
Robert
Top achievements
Rank 1
Answers by
Eric Lawrence
Telerik team
Robert
Top achievements
Rank 1
Share this question
or