UFT 23.4 Http Request json escape characters

Hi,

we're facing a problem with API Test that use an HTTP Request. The test has been created using 2021R1 version and use a JSON format. The json is formatted in the correct way and if the test run using 2021R1 the request correctly add the escape character for double quote. Instead using 23.4 the escape character does not add in the request and it fails.

INPUT JSON is something like this:

{"param1":"value1","param2":"value2"}

using UFT 2021R1 the request is correctly managed and I can see in the report:

{\"param1\":\"value1\",\"param2\":\"value2\"}

using UFT 23.4 the request has send in plain text and fails:

{"param1":"value1","param2":"value2"}

Do you know if there is some option in UFT to set?

thank you,

Massimo.

Parents
  • 0

    Hi,

    just to know, we use this approach for the moment:

    1. insert the block to manipulate string: ReplaceString - insert the string to analyze in the source string value.
    2. in the event OnBefore... for the ReplaceString we put the code to evaluate the UFT version: if 2023 make the change
    3. pass the result to the other block as input

    The code is this one:

    if (Application.ProductVersion.Contains("2023"))
    {
         this.ReplaceStringActivity4.SearchReplaceString[0].Key = @"""";
         this.ReplaceStringActivity4.SearchReplaceString[0].Value = @"\""";
    }

    adding 3 using before the namespace:

    using System;
    using System.Data;
    using System.Windows.Forms;

    I hope this could help while the fix will be provide.

    Massimo.

Reply
  • 0

    Hi,

    just to know, we use this approach for the moment:

    1. insert the block to manipulate string: ReplaceString - insert the string to analyze in the source string value.
    2. in the event OnBefore... for the ReplaceString we put the code to evaluate the UFT version: if 2023 make the change
    3. pass the result to the other block as input

    The code is this one:

    if (Application.ProductVersion.Contains("2023"))
    {
         this.ReplaceStringActivity4.SearchReplaceString[0].Key = @"""";
         this.ReplaceStringActivity4.SearchReplaceString[0].Value = @"\""";
    }

    adding 3 using before the namespace:

    using System;
    using System.Data;
    using System.Windows.Forms;

    I hope this could help while the fix will be provide.

    Massimo.

Children