Body Data Contains Parameter Delimiter

From PeformIQ Upgrade
Jump to navigation Jump to search

Overview

Somtimes HTML body contains data which uses the LoadRunner parameter delimiters '{' and '}'. Rendering this in web calls will break the parameter substitution. One way to avoid this is to use an alternative pair of delimiter characters - for example, to something like '[' and ']', provided the HTML data does not contain these.

Where this occurs in only a small number of HTML pages it may be simpler to do something like this where you build the parameter programatically and thus hide the offending characters from the substitution engine:

    char body[128];

    sprintf(body, "{Location: \"%f,%f\" }", location.latitude, location.longitude);
    
    lr_save_string(body, "Body");
    
    web_custom_request("SetCurrentLocation", 
        "URL=https://{Host}/{Application}/Application/SetCurrentLocation", 
        "Method=POST", 
        "Resource=0", 
        "RecContentType=application/json", 
        "Referer=https://{Host}/{Application}/Application", 
        "Snapshot=t16.inf", 
        "Mode=HTML", 
        "EncType=application/json", 
        "Body={Body}", 
        LAST);