首页 > 代码库 > Loadrunner在post请求的cookie中插入其它多个值

Loadrunner在post请求的cookie中插入其它多个值

有一个商城,提交订单的时候,需要在post请求的cookie中set一个code码,便于防刷

 1 tijiao() 2 { 3  4     lr_think_time(1); 5  6     web_reg_save_param("validcode", 7         "LB=validcode=", 8         "RB=;", 9         "Search=All",10         LAST);11      12     13      14     web_submit_data("toSubmitOrderAjax.jsp", 15         "Action=http://v2.pconline.com.cn:8005//toSubmitOrderAjax.jsp?_time=1472717987749", 16         "Method=POST", 17         "RecContentType=text/html", 18         "Referer=http://v2.pconline.com.cn:8005//order.jsp", 19         "Snapshot=t279.inf", 20         "Mode=HTTP", 21         ITEMDATA, 22         "Name=userAddressId", "Value=http://www.mamicode.com/21", ENDITEM, 23         "Name=goodsId", "Value=http://www.mamicode.com/29262", ENDITEM, 24         "Name=specsId", "Value=http://www.mamicode.com/90", ENDITEM, 25         "Name=count", "Value=http://www.mamicode.com/1", ENDITEM, 26         LAST);27 28     29      lr_output_message("# 响应头信息:\n %s",lr_eval_string("{validcode}"));30      31      web_add_cookie("hyhphone=13610262187; DOMAIN=v2.pconline.com.cn");32 33     web_add_cookie("hyhuserkey={userkey}; DOMAIN=v2.pconline.com.cn");34     35     web_add_cookie("validcode={validcode}; DOMAIN=v2.pconline.com.cn");36     37     web_submit_data("submitOrder.jsp", 38         "Action=http://v2.pconline.com.cn:8005//submitOrder.jsp", 39         "Method=POST", 40         "RecContentType=text/html", 41         "Referer=http://v2.pconline.com.cn:8005//order.jsp", 42         "Snapshot=t280.inf", 43         "Mode=HTTP", 44         ITEMDATA, 45         "Name=count", "Value=http://www.mamicode.com/1", ENDITEM, 46         "Name=goodsId", "Value=http://www.mamicode.com/29262", ENDITEM, 47         "Name=specsId", "Value=http://www.mamicode.com/90", ENDITEM, 48         "Name=userAddressId", "Value=http://www.mamicode.com/21", ENDITEM, 49         "Name=payType", "Value=http://www.mamicode.com/alipay", ENDITEM, 50         "Name=comment", "Value=http://www.mamicode.com/", ENDITEM, 51         LAST);52 53     54     return 0;55 }

 

Loadrunner在post请求的cookie中插入其它多个值