JSON object modified request with headder

4 posts, 0 answers
  1. Billy
    Billy avatar
    3 posts
    Member since:
    Sep 2019

    Posted 23 Sep Link to this post

    Ive created a fiddlescript rule with the help of many people on this fourm, thank you.

    The script would check for a specific json object from the get request in the decoded response body from an application and once the request response body has found   object:value, automatically send the a portion of the json value back to a different URI as a post request with the same header information such as cookies along with connection keep alive.

    When the script is activated upon arrival of said content I receive an error. I assume its something to do with the json object value.

    static function OnBeforeResponse(oSession: Session) {
        if (oSession.oResponse.headers.ExistsAndContains("Content-Type", "application/json")) {
            oSession["ui-backcolor"] = "blue";
            oSession.utilDecodeResponse();
        }
        if (oSession.oResponse.headers.ExistsAndContains("Content-Type", "application/json") && oSession.utilFindInResponse("faceId", false) > -1) {
            oSession["ui-backcolor"] = "green";
            oSession.utilDecodeResponse();
            var oBody = System.Text.Encoding.UTF8.GetString(oSession.requestBodyBytes);
            var j = Fiddler.WebFormats.JSON.JsonDecode(oBody);
            var facId = j.JSONObject["faceId"];
            var reqBod = '{"faceId":"' + facId + '"}';
            oSession.oRequest.headers.HTTPMethod == "POST";
            oSession.utilSetRequestBody(reqBod);
            oSession.url = "https://urltosendpostrequest.com/Search";
            FiddlerObject.utilIssueRequest(oSession);
        }

    Ive been referencing many different pages and fiddlerscripts on this topic and have gotten this far only from a little knowledge of coding and much googling. One code stood out. I dont take credit for this.


  2. Billy
    Billy avatar
    3 posts
    Member since:
    Sep 2019

    Posted 23 Sep Link to this post

    No editing on these coding fourms, lol what a shame. Admin please remove second code as I did not realize it has sensitive information that most likely has already been cached.
  3. Billy
    Billy avatar
    3 posts
    Member since:
    Sep 2019

    Posted 24 Sep Link to this post

    Admins skipping this thread in order to reply to other threads with a generic response. Please do your job its Tuesday.
  4. Simeon
    Admin
    Simeon avatar
    234 posts

    Posted 25 Sep Link to this post

    Hello Billy,

    The code was removed.

    Regards,
    Simeon
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top