How to store and reuse cookies in Postman?

后端 未结 4 1101
感情败类
感情败类 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:18

    Store the cookie value you want to use in a global variable.In Tests tab of login request, write

    postman.setGlobalVariable('key', postman.getResponseCookie("cookieName").value);
    

    Pass along with the value in the Headers tab as a cookie in get user request:

    Cookie | cookieName={{key}}
    

提交回复
热议问题