Created
July 5, 2017 10:23
-
-
Save sivaprabug/65dfea22719d220539fdb4f287d6c5c3 to your computer and use it in GitHub Desktop.
Set cookie value and csrf value as global postaman value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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