-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
I have a post man package in my local package library called "postman-helpers".
When I try to access pmlib like so I get an error:
// postman-helpers package
eval(pm.globals.get('pmlib_code'));
const { KEYUTIL, hextob64 } = pmlib.rs;
// in a REST pre request script
const { helper } = pm.require('postman-helpers');
helper();
This is the error:
There was an error in evaluating the Pre-request Script:Error: Error in package 'postman-helpers': pmlib is not defined
When I copy the script and run it in the pre request script for my REST call, it works fine. When running in the package it breaks.
The problem is also not about the globals. I can print the "pmlib_code" global fine in my package code.
I also cannot access pmlib when running this small script:
const axios = require('axios');
const doTheThing = async () => {
const res = await axios.get('https://joolfe.github.io/postman-util-lib/dist/bundle.js');
console.log(res.data)
eval(res.data)
console.log(pmlib)
}
doTheThing();
this is the error from the above script:
console.log(pmlib)
^
ReferenceError: pmlib is not defined
Metadata
Metadata
Assignees
Labels
No labels