Created
November 26, 2019 07:59
-
-
Save esabook/acc4a8dff011a218b58e684277c641f1 to your computer and use it in GitHub Desktop.
Example usage of auto swith url, set username, save token
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
// prerequest script | |
// hooked before call | |
if (pm.environment.get("offline")=="on"){ | |
pm.environment.set("baseURL", pm.environment.get("offlineSite")); | |
}else{ | |
pm.environment.set("baseURL", pm.environment.get("onlineSite")); | |
} | |
pm.environment.set("username", "salt"); | |
pm.environment.set("password", "salt"); | |
// test script | |
// hooked after call | |
var jsonData = pm.response.json(); | |
postman.setEnvironmentVariable("token", jsonData.msg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment