邮递员脚本:“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屋!