这是我的请求前脚本。 // Computes the HMAC for requests sent to the Coinbase Pro API.
//
// - Add the following code as Postman pre-request script
// - Adapt the getPatch function an the variable names according to your needs
const timestamp = Math.floor(Date.now() / 1000);
function getPath(url) {
//
我在Postman中有以下用于设置环境变量的Pre-request脚本
var current_timestamp = Date.now();
var current_timestamp = current_timestamp ;
var past = current_timestamp - 134;
postman.setEnvironmentVariable("current_timestamp", Number(current_timestamp));
postman.setEnvironmentVariable("past", Number(past))
我尝试用Postman编写一个预请求脚本。我想发出一个请求,所以我尝试使用。例如:
pm.sendRequest('http://example.com', function (err, res) {
//...
});
但是我得到了这个错误:
There was an error in evaluating the Pre-request Script: pm is not defined
我用的是Windows 10。我刚更新了扩展。
如何访问pm
我不想将评论作为JSON的一部分发送,我只想在JSON请求的PostMan Body选项卡中给自己一个提示。
例如,我的JSON主体如下:
/* just some comment here */
{
"username": "mike",
"usertype": 1,
"userid": "3333333",
"id": "kasd331"
}
如果我删除顶部的评论(/* just some comment here */),并发送这个请求和正文,它