rest - How can I fetch a value from response of web_custom_request in LoadRunner -


i have lr script , using make call on rest api download file. file gets downloaded need value of file size downloaded verification purpose. here see in loadrunner console.

action.c(50): web_custom_request("getimage") successful, 2373709 body bytes, 528 header bytes, 99 chunking overhead bytes. 

how can value 2373709?? tried using below code size returns little bit different above mentioned , not solving purpose.

httpdownloadsize=web_get_int_property(http_info_download_size);  lr_output_message("file size %i", httpdownloadsize); 

any appreciated. in advance help.

http_info_download_size property stores last http response total download size. includes total size of headers , bodies of responses, , possible communication overhead. 2373709 body bytes total body size of responses got in particular step, if there several requests/responses in custom request step, number greater actual file size.

i'd suggest validating response body size. there no standard api retrieve though (at least, in lr 12.53, latest available version). far see, response chunked cannot suggest efficient methods this. here rather inefficient method based on storing whole body temporary buffer (twice!):

unsigned long length = 0; char* tmp = 0;  web_reg_save_param_ex(     "paramname=body",      "lb=",      "rb=",                       search_filters,      "scope=body",     "relframeid=1",     last);  web_custom_request(...);  lr_eval_string_ext("{body}", strlen("{body}"), &tmp, &length, 0, 0, -1); lr_output("body length %d", length); lr_eval_string_ext_free(&tmp); 

also might need increase maximum html parameter length using web_set_max_html_param_len().

however, if had non-chuncked non-compressed response containing content-length header, validate more efficiently:

web_reg_find("text=content-length: 2373709",     "search=headers",     "relframeid=1",     last); web_custom_request(...); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -