Difference between revisions of "Body Data Contains Parameter Delimiter"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) |
PeterHarding (talk | contribs) |
||
Line 3: | Line 3: | ||
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. | 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 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: | ||
<pre> | <pre> | ||
char body[128]; | char body[128]; | ||
sprintf(body, "{Location: \"%f,%f\" }", location.latitude, location.longitude); | sprintf(body, "{Location: \"%f,%f\" }", location.latitude, location.longitude); | ||
lr_save_string(body, "Body"); | lr_save_string(body, "Body"); | ||
web_custom_request("SetCurrentLocation", | 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); | |||
</pre> | </pre> | ||
[[Category:LoadRunner]] | [[Category:LoadRunner]] |
Latest revision as of 17:27, 24 September 2014
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);