I want to use the moment.js (or any other script) in Postman Native App

12,450

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...

Share:
12,450
Thanasarut
Author by

Thanasarut

learner for the technology software development.

Updated on June 04, 2022

Comments

  • Thanasarut
    Thanasarut almost 2 years

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

    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>
    

    at the path

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

    in a file

    tester_sandbox.html
    

    for able to use moment in "Tests" or

    requester.html
    

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

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

    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 ......

    thanks