我正在尝试准备API帖子请求的脚本,如下所示
web_rest("POST: http://remote-data-dashboard-app.apps.eu01.cf.cano...",
"URL=http://remote-data-dashboard-app.apps.eu01.cf.canopy-cloud.com/login",
"Method=POST",
"EncType=raw",
"Snapshot=t700233.inf",
"Body={\n"
""username":"XXXX",\n"
""password":"XXXXX"\n"
"}",
HEADERS,
"Name=Accept", "Value=application/json", ENDHEADER,
"Name=Accept-Charset", "Value=UTF-8", ENDHEADER,
"Name=Content-Type", "Value=application/json", ENDHEADER,
LAST);
但它抛出错误说400坏请求(语法错误)。但我已经检查了很多次,但它看起来很好的URL和参数,因为我已经使用相同的Jmeter和它的工作正常。 帮助将不胜感激
答案 0 :(得分:0)
我认为你需要逃避“
web_rest("POST: http://remote-data-dashboard-app.apps.eu01.cf.cano...",
"URL=http://remote-data-dashboard-app.apps.eu01.cf.canopy-
cloud.com/login",
"Method=POST",
"EncType=raw",
"Snapshot=t700233.inf",
"Body={\n"
"\"username\":\"XXXX\",\n"
"\"password\":\"XXXXX\"\n"
"}",
HEADERS,
"Name=Accept", "Value=application/json", ENDHEADER,
"Name=Accept-Charset", "Value=UTF-8", ENDHEADER,
"Name=Content-Type", "Value=application/json", ENDHEADER,
LAST);