Skip to content

Instantly share code, notes, and snippets.

@mesaglio
Last active May 15, 2020 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mesaglio/8ea74e7c2cf9c476c29b068957aaba8c to your computer and use it in GitHub Desktop.
Save mesaglio/8ea74e7c2cf9c476c29b068957aaba8c to your computer and use it in GitHub Desktop.
pre-request
const echoPostRequest = {
url: pm.environment.get('baseUrl') + '/login',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
"mail": "asd@amazon.com",
"password": "HXtaSUzh"
})
}
};
pm.sendRequest(echoPostRequest, function (err, res) {
var responseJson = res.json();
pm.environment.set('token', responseJson.token)
});
// to update variables, use tests
var data = pm.response.headers.get("x-access-token");
pm.environment.set('token', data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment