如何在 Postman 的当前时间戳中添加更多时间?

Hes*_*sam 6 postman

我知道我可以像这样将当前时间戳添加到请求中:

postman.setEnvironmentVariable('pickUpTime',(new Date()).toISOString());

但是,我想将 10 分钟后添加到 Postman 的当前时间戳。我怎样才能做到这一点?

似乎我不能这样做:

postman.setEnvironmentVariable('pickUpTime',(new Date() + 10000).toISOString());

Dan*_*ton 7

你可以在 Postman 中使用moment.jsadd功能,它让这种类型的东西变得如此简单和易于管理。

var moment = require("moment")

pm.environment.set('pickUpTime', moment().add(10, 'minutes').toISOString())
Run Code Online (Sandbox Code Playgroud)

这将使用较新的语法将此值设置为环境变量。