How to store and reuse cookies in Postman?

后端 未结 4 1104
感情败类
感情败类 2021-02-20 10:00

I\'m using Postman to test and play with an API.

For the login url, the API requires sending a POST request with username and password as fiel

4条回答
  •  深忆病人
    2021-02-20 10:23

    I tried using Ashutosh's answer but got an error. I'm guessing this is because Postman's scripting API changed?

    At any rate, the following worked for me:

    1. In the Tests tab of the request that will return cookies you want to save, write
    pm.globals.set('', pm.cookies.get(''));
    
    1. Then, as described in Ashutosh's answer, add the cookie to the headers by setting the key as cookie and corresponding value as ={{}};.

    I found documentation for this at the Postman sandbox API reference.

提交回复
热议问题