Hi there,
can you help me? I want to search and replace ainside a html-file.
It means there is a request like "index.html" and than I want to replace a part of this with a local snippet and at the end it should be delivered to the brower as "the respond"
At the Moment I write a Funktion and call it
*script:TestFunc
It is called because I see a log, but I do'n't know what's next :-/
Thanks!
Cya
Dominic
5 Answers, 1 is accepted
From the sound of it though, you want your request to be sent to the network and you just want to modify the response that comes back. If so, what you need to use is script inside your OnBeforeResponse method. See e.g. http://docs.telerik.com/fiddler/KnowledgeBase/FiddlerScript/ModifyRequestOrResponse
Regards,
Eric Lawrence
Telerik

Thanks for your answer.
To use the OnBeforeResponse method it's not a good way for me, I know this method. I had to switch this rules on/off in a simple way.
What to you think about this:
1. the requests...
2. I load the original site with js
3. I modify the original site
4. I return the motified site as the response
Do you have a small example how I can give a response with a script?
Thanks!
Cya
Dominic

If you always want to return the same modified response, you don't need a script for that. Edit the response (either at a breakpoint or by using the "Unlock for Editing" command on the Web Session's context menu) then drag/drop the Session to Fiddler's AutoResponder tab to create a new rule that always plays back that response.
To always respond with a script, make a rule like:
MatchText: whatever
Action: *script:DoMagic
Save the rule. Click Rules > Customize Rules. Inside the Handlers class add the following code:
static function DoMagic(oS: Session)
{
oS.utilCreateResponseAndBypassServer();
oS.oResponse.headers.StatusDescription = "Magic!";
oS.utilSetResponseBody("Some magic just happened to session #" + oS.id);
}
Regards,
Eric Lawrence
Telerik
