邮递员创建 class
Postman create class
我的目标很简单。我想创建一个名为 class 的 Helper 来为我的 collection.
存储所有常见的 data/methods
我打算这样做:
在主要的 pre-request 脚本中,这是代码:
var HELPER = pm.globals.get("HELPER");
console.log(HELPER.mandatory);
console.log(HELPER.checkIfEmpty());
我能够检索强制变量,但我无法调用 checkIfEmpty
我收到以下消息:
TypeError: HELPER.checkIfEmpty is not a function
如你所见,这个方法是存在的。
我检查了这个 link 但没有成功...
你知道我错过了什么吗??
我找到了一种方法来管理我的预期:
和主要的预请求脚本代码:
console.log(helper.mandatorySubIssues());
console.log(helper.checkIfEmpty("Hello World"));
我的目标很简单。我想创建一个名为 class 的 Helper 来为我的 collection.
存储所有常见的 data/methods我打算这样做:
在主要的 pre-request 脚本中,这是代码:
var HELPER = pm.globals.get("HELPER");
console.log(HELPER.mandatory);
console.log(HELPER.checkIfEmpty());
我能够检索强制变量,但我无法调用 checkIfEmpty
我收到以下消息:
TypeError: HELPER.checkIfEmpty is not a function
如你所见,这个方法是存在的。
我检查了这个 link 但没有成功...
你知道我错过了什么吗??
我找到了一种方法来管理我的预期:
和主要的预请求脚本代码:
console.log(helper.mandatorySubIssues());
console.log(helper.checkIfEmpty("Hello World"));