Vladimir Zemlyanoi
Vladimir Zemlyanoi

Reputation: 21

Fiddler scripting - How to send response to another server?

Please help me)

I need to send (forward) some responses from server1 to server2 using Fiddler.

More details:

Server1 sends me a lot of responses with different data inside JSON body.

1) I need to find responses that contain word "message" inside JSON body.

2) I need to send those responses with JSON bodies to my server2.

How to do it using Fiddler?

For now I wrote a script that saves required JSON bodies to the file:

if (oSession.PathAndQuery.Contains("sendresponse")) 
    {
    var bodystr=oSession.GetResponseBodyAsString();
        if (bodystr.Contains("message"))
            {
            var directory2 = "C:\\log\\NEXT\\";
            var filename2 =  "JSON_BODY";
            var path2: String = System.IO.Path.Combine(directory2, filename2);
            oSession.SaveResponseBody(path2+".txt");
            }
    }

But i need those bodies to be automatically sent to the server 2.

Upvotes: 0

Views: 505

Answers (1)

Vladimir Zemlyanoi
Vladimir Zemlyanoi

Reputation: 21

Did it!! Used FiddlerObject.utilIssueRequest() function.

bodystr - it's the body of POST request. Could be any.

var Address = "POST http://192.168.0.106/ HTTP/1.1\r\nUser-Agent: Fiddler\r\nHost: 192.168.0.106\r\nContent-Length: 7\r\n\r\n";
FiddlerObject.utilIssueRequest(Address+bodystr); 

Upvotes: 2

Related Questions