Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set cookie value and csrf value as global postaman value
tests["Status code is 200"] = responseCode.code === 200;
// getting CSRF token value from responseBody and stored in global variable
var data = JSON.parse(responseBody);
console.info("CSRF Token Value = " + data.CSRFToken);
postman.setGlobalVariable("csrftoken", data.CSRFToken);
// getting QSESSIONID value from Cookie and stored in global variable
var qsessionidValue = postman.getResponseCookie("QSESSIONID").value
console.log(qsessionidValue);
postman.setGlobalVariable("QSESSIONID", qsessionidValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.