Web_add_header And Web_add_auto_header Usage In Loadrunner
By Sam Z // Monday, January 19, 2015
Web_add_header: Web_add_header function is used to add header only to HTTP request that follows it. Example: web_add_header("Cookie", "{Cookie_ID}"); web_add_header("Pragma", "no-cache"); web_url("webmail", "URL=http://{URL}/etc/apps/webmail/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); web_add_header("Cookie", "{Cookie_ID}"); web_add_header("Pragma", "no-cache"); web_url("webmail_3", "URL=http://{URL}/etc/apps/webmail/?_task=mail&_action=getunread&_remote=1&_unlock=0&_={TimeStamp}", "Resource=0", "RecContentType=text/plain", "Referer=http://{URL}/etc/apps/webmail/?_task=mail", "Snapshot=t2.inf", "Mode=HTML", LAST); web_add_auto_header: Web_add_auto_header function is used to add header to all the consecutive HTTP requests. Web scripts usually send the standard header requests automatically for each request. If you need additional headers to be sent then you can use web_add_header or web_add_auto_header. web_add_header only sends to the HTTP request that follows it, whereas web_add_auto_header sends to all the succeeding requests. Web_add_header and web_add_auto_header is automatically generated in your script, if you enable this in Record -> recording options->Advanced->Headers->Record Headers not in list. Example: web_add_auto_header("Cookie", "{Cookie_ID}"); web_add_auto_header("Pragma", "no-cache"); web_url("webmail", "URL=http://{URL}/etc/apps/webmail/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); web_url("webmail_3", "URL=http://{URL}/etc/apps/webmail/?_task=mail&_action=getunread&_remote=1&_unlock=0&_={TimeStamp}", "Resource=0", "RecContentType=text/plain", "Referer=http://{URL}/etc/apps/webmail/?_task=mail", "Snapshot=t3.inf", "Mode=HTML", LAST);