写了个脚本,可以不用每次都人工放入token:
const postRequest={
url: 'https://0.0.0.0:8888/access/v2.0/token',
method: 'POST',
header: {},
body: {
mode: 'raw',
raw: JSON.stringify({"accessKey":"admin","secretKey":"secretKey888"})
}
};
pm.sendRequest(postRequest, (error, response) => {
const token = response.json().data.id;
pm.environment.set("Token", token);
console.log("pre script token:" + token)
pm.request.headers.upsert({
key: 'x-open-token',
value: token
});
});