我想在 Postman Native App 中使用 moment.js(或任何其他脚本) [英] I want to use the moment.js (or any other script) in Postman Native App

查看:43
本文介绍了我想在 Postman Native App 中使用 moment.js(或任何其他脚本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道使用 Chrome 插件的 Postman 解决方案....

I know the solution for Postman with Chrome Plugin....

我的 Postman with Chrome Plugin 的解决方案是在我的mbp我刚刚添加了这些行,也将 moment.min.js(或任何 javascript 文件)作为描述的路径

the solution for my Postman with Chrome Plugin is on my mbp I've just add these line also put the moment.min.js (or any javascript file) as path described

<script type="text/javascript" src="../js/tester/moment.min.js"></script>

在路径上

~/Library/Application Support/Google/Chrome/Default/Extensions/fhbjgbiflinjbdggehcddcbncdddomop/5.4.0_0/html/

在一个文件中

tester_sandbox.html

为了能够在测试"中使用时刻或

for able to use moment in "Tests" or

requester.html

为了能够在预请求脚本"中使用时刻

for able to use moment in "Pre-request Script"

但我找不到 Postman Native App 保存这些文件路径的位置....

but i can't find where the Postman Native App keeps these file path....

我已经尝试过在谷歌上找到的另一种解决方案将脚本添加为 GlobalVariable 然后在测试"中 eval 但它仍然不起作用...

i've already try another solution that i found on google about add the script as an GlobalVariable then eval in "Tests" but it's still not work...

任何想法或任何推荐......

any ideas or any recommended ......

谢谢

推荐答案

要使用 moment,您需要将此添加到您的预请求脚本或测试选项卡的顶部

To use moment you need to add this to the top of you pre-request scripts or tests tab

var moment = require('moment')

然后您可以按照文档使用该模块.

Then you can use the module as per the docs.

moment().add(2, 'days').format()

或者任何你需要的......

Or whatever you need...

这篇关于我想在 Postman Native App 中使用 moment.js(或任何其他脚本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆