In postman, I have a pre-request scenario where I have to take a cookie value and store it in the environment variable, say csrf in my case, and use it for the API request. As shown in the image, I have 2 cookies for the domain namely XSRF-TOKEN and _d. I have to take only the XSRF-TOKEN for the particular domain and store it in csrf variable. I have to exclude Path, Domain and the Secure fields
My pre-request script:
pm.environment.set("csrf", pm.cookies.get('XSRF-TOKEN'))
With this, the environment variable csrf is stored as null, and I don't understand where I have gone wrong. Any help is appreciated.