Forked from dariayermolova/postman pre-request script (post raw)
Created
May 13, 2021 10:59
-
-
Save vitaliiSmokov/23bd3a46f814895dceb84308585a214c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var random_id = parseInt(Math.random() * 10000); | |
pm.environment.set("random_id", random_id); | |
var domain = pm.environment.get("domain"); | |
pm.sendRequest({ | |
url: "https://api"+domain+"./signup", | |
method: 'POST', | |
header: { | |
'Content-Type': 'application/json', | |
}, | |
body: { | |
mode: 'raw', | |
raw: JSON.stringify({"email":"test", | |
"password":"test"}) | |
} | |
}, function (err, response) { | |
pm.environment.set("token", response.json().data.token); | |
pm.environment.set("id", response.json().data.user.data.id); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment