var moment = require('moment');

var entryTime = moment().format("YYYYMMDDHHmmssSSS");
var exitTime = moment().format("YYYYMMDDHHmmssSSS");


pm.globals.set("entryTime", entryTime);
pm.globals.set("exitTime", exitTime);
  1. 首先引入moment库;
  2. 使用moment()方法获取当前时间,并格式化为YYYYMMDDHHmmssSSS的时间戳;
  3. 控制台打印语句是为了方便查看取值是否正确。如何调出Postman的控制台?View–>Show Postman Console
  4. 设置全局变量

二、在request body中使用全局变量




【版权说明:仅允许非商业转载且请注明出处:Mac私塾 网址:】
  1. After checking out a few of the blog articles on your website, I really like your way of writing a blog. I added it to my bookmark webpage list and will be checking back in the near future. Take a look at my web site as well and tell me what you think. Dael Adolphe Cly

  2. Wow Dan and Lisa, I conjured you! Only an hour ago I was thinking of you guys and hoping you were weathering this storm and planning to rise up and head out into the wind and tell us all about your experiences. So happy to read your post just now! Sending good vibes for your upcoming ride! Aimil De Witt Leland

  3. The road seemed to stretch on endlessly before us, but Alexis assured me that our journey was near an end. We’d turn before long into thick woods and travel through narrow, winding roads until we reached her family’s cabin. I had no choice but to trust her as GPS had given out nearly 20 minutes ago.

    “There’s good wifi and okay reception at the cabin,” she’d told me, “but you can’t get there unless you know the way.”

    So here I was, driving alone in the middle of god knows where with a girl who was my student just a couple of weeks ago. Her and her four best friends had been together from first grade all the way through high school and now they had graduated with very different futures ahead of them. They had decided to kick off “the best summer ever” with a week long stay at Alexis’s family cabin. Alexis and I were heading up before everyone else, the four other girls and four guys.



Captcha Code