求助大神~LR返回错误HTTP Status-Code=400 (Bad Request)
测试的HTTP接口,post方法,在JMeter和RC里运行都是正常的,在LR中一直报错。Action()
{
web_custom_request("overspeed",
"URL=http://10.23.101.221:8080/sc-eventalert-ws/ws/0.1/test/addEvent",
"Method=POST",
"Resource=0",
"Mode=HTTP",
"EncType=application/json;charset=UTF-8",
"Body={\"vehicleId\":3000546,\"partnerId\":10560,\"category\":\"超速报警\",\"detail\":{\"address\":{\"province\":\"北京市\",\"city\":\"北京市\",\"district\":\"丰台区\",\"road\":\"正阳大街\",\"poi\":\"药店(正阳大街)附近\"},\"alertTime\":\"2015-01-28 11:45:14\",\"alertType\":\"9\",\"appId\":10560,\"latitude\":\"39.84998562282986\",\"longitude\":\"116.289638671875\",\"overlayId\":10440,\"overlayName\":\"万发大厦-燕山站\",\"overlayPoints\":\"\",\"overlayType\":\"3\",\"speed\":60,\"strategyId\":17389,\"terminalId\":\"3000649\",\"valve\":\"1\"},\"location\":{\"lng\":\"116.50253\",\"lat\":\"39.91683\",\"speed\":\"19.82\"},\"time\":\"2015-03-11 16:22:11\"}",
LAST);
return 0;
}
返回错误:
Action.c(5): Error -26631: HTTP Status-Code=400 (Bad Request) for "http://10.23.101.221:8080/sc-eventalert-ws/ws/0.1/test/addEvent"
Action.c(5): web_custom_request("overspeed") highest severity level was "ERROR", 220 body bytes, 313 header bytes "http://10.23.101.221:8080/sc-eventalert-ws/ws/0.1/test/addEvent 先检查这个接口能不能正常访问。 HTTP400您的Web服务器认为客户端发送的数据流 (例如您的浏览器或我们的 CheckUpDown 机器人 ) 是 ' 畸形的',即没有完全遵守 HTTP 协议
应该是缺少头文件引起的,用web_add_header添加头文件 这个问题怎么解决的 对比录制的request和回放的request
目测问题在header上。。
页:
[1]