Postman associated interfaces Test (with authentication token)
A landing Interface
- Creating a request Request
- Add JavaScript code in the Tests, to acquire an authorization
pm.test("V2", function () {
//jsonData:响应的所有json信息
var jsonData = pm.response.json();
var token = jsonData.data.token;
//将token值添加到token环境变量中
pm.environment.set("token",token)
});
Second, the environment variable is added while getting registered in the cash value token interface
Add Authorization request header attribute, attribute value token value
Get token value of the environment variable, for obtaining a {} {}
Click to send successful operation