参数值加密
使用postman进行接口测试时,会经常碰到参数值加密的情况,比如使用签名sign MD5加密,以下为postman进行加密的方法:
参照官方文档:
https://www.getpostman.com/docs/sandbox
我们可以通过CryptoJS进行加密,打开postman接口请求界面
postman
在Pre-request Script中输入以下脚本:
var str = environment.variable_1 + environment.variable_2;
var hash = CryptoJS.MD5(str).toString();
postman.setEnvironmentVariable(‘hash’, hash);
然后在请求的url Params里 sign keyvalue中输入{{hash}},就可以将加密值添加到sign里,其他加密方式可参考官方文档和模板来实现。