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.