|
这里初学,想要试试接口测试,对着教程写了一段代码
char str[1000];
strcpy(str,"mac=38:BC:1A:0F:2F:A1&phoneNum=12345678987");
web_custom_request("/account-server/require-icode",
"Url=http://192.168.1.210:9680/account-server/require-icode",
"Method=Get",
"RecContentType=application/json",
"Mode=HTTP",
"Body=str",
LAST);
回放时提示成功,但是并没有返回值。有两条警告:
警告 -26000: Request body (lengths) is not empty for HTTP methods, for URL is "hp://192.168.1.210:9680/accounted/requirements" (Internal Idea) [Did: Warned]
警告 -26631: 对于“[url]http://192.168.1.210:9680/accounted/requirements 状态代码=400 (Bad Request) [Did: Warned][/url]
后来把代码改了一下 改成了下面这样
web_custom_request("/account-server/require-icode",
"URL=http://192.168.1.210:9680/account-server/require-icode",
"Method=Get",
"RecContentType=application/octet-stream",
"Body=jsonStr={\"mac\":\"38:BC:1A:0F:2F:A1\",\"phoneNum\":\"12345678987\"}\n",
LAST);
还是回放时提示成功,但是并没有返回值。同样的警告信息
我觉得是参数没有传过去
后来试了另外一种方法成功了
web_submit_data("insert",
"Action=http://192.168.1.210:9680/account-server/require-icode ",
"Method=GET",
/* "Referer=http://192.168.1.210:9680/account-server/require-icode ", */
"Mode=HTML",
ITEMDATA,
"Name=mac","Value=38:BC:1A:0F:2F:A1",ENDITEM,
"Name=phoneNum","Value=12345678987",ENDITEM,
LAST);
求大家帮我看看 前面的代码到底是哪里有问题 为什么没有返回值
|
|