碰到个奇怪的接口请求消息,求指导
抓包发现一个接口的请求消息:POST /SyncUnifiedPayStatus HTTP/1.1content-type: text/plain
User-Agent: Java/1.8.0_91
Host: 172.20.100.63:31085
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 194
{
."orderId": "BOSS201708311002021249643",
."state": "00",
."purchaseTime": "2017-06-23 10:05:05",
."enableTime": "2017-06-23 10:05:05",
."disableTime": "2017-06-24 10:05:05",
."payType": "02"
}HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
Content-Type: application/json;charset=utf-8
Content-Length: 27
Date: Thu, 31 Aug 2017 07:07:48 GMT
{"state":"00","message":""}
请求消息体中有个大括号{},请问这个怎么用loadrunner来构造请求消息,用web_custom_request构造如下:
Action()
{
web_reg_save_param("Return",
"LB=",
"RB=",
LAST );
//lr_rendezvous("test1");
//web_reg_find("Text=64QAM", "Fail=NotFound",LAST);
web_custom_request("web_custom_request",
"URL=http://172.20.100.63:31085/SyncUnifiedPayStatus",
"Method=POST",
"Resource=0",
"Referer=",
"Mode=HTML",
"EncType=text/plain;"
"Body=orderId=BOSS201708311002021249643&state=00&purchaseTime=2017-06-15 10:05:05&enableTime=2017-06-15 10:05:05&disableTime=2018-07-25 12:05:05&payType=02",
LAST);
lr_output_message(lr_eval_string("{Return}"));
return 0;
}
但是抓取这个请求消息不对:
POST /SyncUnifiedPayStatus HTTP/1.1
Content-Type: text/plain;Body=orderId=BOSS201708311002021249643&state=00&purchaseTime=2017-06-15 10:05:05&enableTime=2017-06-15 10:05:05&disableTime=2018-07-25 12:05:05&payType=02
Cache-Control: no-cache
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT)
Accept-Encoding: gzip, deflate
Accept: */*
Connection: Keep-Alive
Host: 172.20.100.63:31085
Content-Length: 0
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
Content-Type: application/json;charset=utf-8
Content-Length: 28
Date: Thu, 31 Aug 2017 07:48:47 GMT
{"state":"500","message":""}
本帖最后由 lmj19851117 于 2017-8-31 16:59 编辑
搞定了,原来这是一个JSON请求串,脚本如下:
Action()
{
web_reg_save_param("Return",
"LB=",
"RB=",
LAST );
//lr_rendezvous("test1");
//web_reg_find("Text=64QAM", "Fail=NotFound",LAST);
web_custom_request("web_custom_request",
"URL=http://172.20.100.63:31085/SyncUnifiedPayStatus",
"Method=POST",
"Resource=1",
"RecContentType=application/json",
"EncType=application/json",
"Body={
\"orderId\":\"BOSS201708311002021249643\",
\"state\":\"00\",
\"purchaseTime\":\"2017-06-15 10:05:05\",
\"enableTime\":\"2017-06-15 10:05:05\",
\"disableTime\":\"2018-07-25 12:05:05\",
\"payType\":\"02\"
}",
LAST);
lr_output_message(lr_eval_string("<Return>"));
return 0;
}
:lol
页:
[1]