Search code examples
postman

Postman scripts : "pm is not defined"


I try to write a Pre-request script in Postman. I want to to make a request so I try to use pm.sendRequest. For example :

pm.sendRequest('http://example.com', function (err, res) {
    //...
});

But I get this error :

There was an error in evaluating the Pre-request Script: pm is not defined

I'm on Windows 10. I just updated the extension.

How do I access pm?


Solution

  • A member posted an answer but, for some reason, I think he got banned. His answer didn't have a lot of details, but was working :

    You have to use the standalone version of Postman for the pm to be accessible. I was using it as a Chrome extension. By switching to the standalone version, it worked. I don't know why, though.