Postman scripts : “pm is not defined”

后端 未结 3 1863
春和景丽
春和景丽 2021-02-05 03:18

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\',          


        
相关标签:
3条回答
  • 2021-02-05 04:01

    Replace pm with postman, it should work fine.

    0 讨论(0)
  • 2021-02-05 04:04

    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.

    0 讨论(0)
  • 2021-02-05 04:18

    If you are running an old version of Postman, you may run into this issue as I did. From https://www.getpostman.com/docs/v6/postman/scripts/test_examples#older-style-of-writing-postman-tests

    The older style of writing Postman tests relies on setting values for the special tests object.

    If you are running an older version of Postman, you will not have the pm object available for use.

    0 讨论(0)
提交回复
热议问题