始发于2017.03.22
Postman 应用中直接使用request.data()
会报错
1、Pre-request Script:
var iContent = request.data[“I”];
console.log(iContent);
2、问题:
上述脚本,在Chrome App 的Postman中,可以正常干活,但在Postman APP中,报错,打印出来内容是 undefined
;
3、问题原因:
官方回复:
The issue here is that
request.data
is an object in the Chrome app, but is an array in the native app. You’ll have to adjust your logic to work with arrays instead of objects.
4、In APP改为:
var reqData = _.indexBy(request.data, "key"),
iContent = reqData["i"].value;
console.log(iContent);
上述脚本就可以正常干活了。。。
始发于2017.03.22