Skip to content

Instantly share code, notes, and snippets.

@sivaprabug
Created July 5, 2017 10:23
Show Gist options
  • Save sivaprabug/65dfea22719d220539fdb4f287d6c5c3 to your computer and use it in GitHub Desktop.
Save sivaprabug/65dfea22719d220539fdb4f287d6c5c3 to your computer and use it in GitHub Desktop.
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