Postman scripts: "pm not defined"

I am trying to write a Pre-request script in Postman. I want to make a request, so I'm trying to use pm.sendRequest . For instance:

 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 ?

+5
source share
2 answers

The participant posted the answer, but for some reason, I think it was blocked. His answer did not have many details, but it worked:

You must use the standalone version of Postman for pm to access. I used it as a Chrome extension. Switching to the standalone version, it worked. However, I do not know why.

+15
source

Replace pm with the postman , it should work fine.

-2
source

Source: https://habr.com/ru/post/1271847/


All Articles