【问题标题】:How to Set to header part Date on Postman api testing tools如何在 Postman api 测试工具上设置标题部分日期
【发布时间】:2019-05-12 02:02:09
【问题描述】:

我一直面临这个问题。邮递员日期格式部分。

我想设置标题区域的日期和时间。喜欢(星期一,03-December-18 07:41:29) 我尝试了 moment.js 导入包。我不能成功。如何在预请求区添加moment js

我阅读了 Postman 文档但无法正确理解

任何人都可以帮助我。

【问题讨论】:

标签: json postman date-format


【解决方案1】:

利用环境变量在请求中添加变量{{$timestamp}}

根据预先要求添加:

var moment = require('moment')
pm.globals.set("timestamp", moment().format("LLLL"))

现在,在您使用 {{$timestamp}} 的请求中将其替换为 {{timestamp}}

输出应该是这样的Thursday, September 4, 1986 8:30 PM

MomentJs format

【讨论】:

猜你喜欢
  • 2022-09-30
  • 2020-05-27
  • 1970-01-01
  • 1970-01-01
  • 2012-06-27
  • 2020-04-27
  • 2021-01-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多