邮递员脚本:“未定义pm”; [英] Postman scripts : "pm is not defined"
问题描述
我尝试用Postman编写一个预请求脚本。我想提出一个请求,所以我尝试使用 pm .sendRequest
。例如:
I try to write a Pre-request script in Postman. I want to to make a request so I try to use pm.sendRequest
. For example :
pm.sendRequest('http://example.com', function (err, res) {
//...
});
但是我收到此错误:
评估预请求脚本时出错:未定义pm
我在Windows 10上我刚刚更新了扩展名。
I'm on Windows 10. I just updated the extension.
如何访问 pm
?
推荐答案
一个成员发布了答案,但由于某种原因,我认为他被禁止了。他的答案没有很多细节,但是很有效:
A member posted an answer but, for some reason, I think he got banned. His answer didn't have a lot of details, but was working :
您必须使用 Postman的独立版本,以供 pm
使用。我将其用作 Chrome扩展 n。通过切换到独立版本,它可以工作。我不知道为什么。
You have to use the standalone version of Postman for the pm
to be accessible. I was using it as a Chrome extension. By switching to the standalone version, it worked. I don't know why, though.
这篇关于邮递员脚本:“未定义pm”;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!