Following this example : https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110170-modifying-post-put-patch-upload-data , I have created the following code :
public override void OnBeforeURLRequest(BeforeURLRequestParams parameters)
{
bool param1Found = false;
bool param2Found = false;
if (parameters != null)
{
if ("POST" == parameters.Method)
{
if (parameters.PostData != null)
{
if (parameters.PostData.ContentType == PostDataContentType.FORM_URL_ENCODED)
{
PostData post = parameters.PostData;
FormData postData2 = (FormData)parameters.PostData;
var mata = postData2.GetPairKeys();
foreach (var item in mata)
{
if (item == "abc")
{
param1Found = true;
}
else if (item == "def")
{
param2Found = true;
}
var coco = postData2.GetPairValues(item);
foreach (var item2 in coco)
{
Console.WriteLine(item + ":" + item2);
}
}
if (param1Found == true && param2Found == true)
{
FormData postData = (FormData)parameters.PostData;
postData.SetPair("abc", "undefined");
parameters.PostData = postData;
}
}
}
}
}
}
however , I can not find my value in Chrome Developer Tools under Network tab, and for some reason the original code from the above link crashes the app (cast error). Am I missing something ? Can some one point me on the right direction ? Thanks.