我需要对我的凭证进行哈希处理才能像这样访问sha2(app-secret:SALT:timestamp)
我在头文件中将其设置为authtoken,它应该具有这个散列值auth-token: api.hashify.net/hash/sha256/{{appSecret}}:{{SALT}}:{{timestamp}}
你能告诉我用法是否正确吗?我的意思是,在钥匙前面加上thisapi.hashify.net/hash/sha256/能得到我需要的东西吗?
发布于 2020-11-28 01:34:48
它将只是作为一个字符串发送给端点,而不会调用到端点,因此改为在pre- request脚本中调用端点,并将响应值存储到一个变量并在auth头中使用它:
// Example with a plain string URL
pm.sendRequest(`https://api.hashify.net/hash/sha256/${pm.environment.get('appSecret')}:${pm.environment.get('SALT')}:${pm.environment.get('timestamp')}`, (error, response) => {
if (error) {
console.log(error);
} else {
console.log(response.json()); // or response.text() if parse error
}
});在else语句中写入逻辑以获取值并使用pm.environment.set("auth-token",value)
现在位于header auth-token:{{auth-token}}中
https://stackoverflow.com/questions/65036420
复制相似问题