新手区 postman 返回数据 base64 解码

尹全旺 · 2017年06月27日 · 最后由 乄動聽縼葎ヤ 回复于 2017年08月10日 · 3517 次阅读

有大神知道 base64 怎么对返回的数据进行 base64 解码吗

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 2 条回复 时间 点赞

纯手工操作
base64 解码有在线解码工具,将 postman 返回数据里面的编码数据拷贝出来去解码就好了。

postman 支持 base64 的解码,在 Tests 中写个输出解码结果就行了
var intermediate,
base64Content, // assume this has a base64 encoded value
rawContent = base64Content.slice('data:application/octet-stream;base64,'.length);

intermediate = CryptoJS.enc.Base64.parse(base64content); // CryptoJS is an inbuilt object, documented here: https://www.npmjs.com/package/crypto-js
tests["Contents are valid"] = CryptoJS.enc.Utf8.stringify(intermediate); // a check for non-emptiness

https://www.getpostman.com/docs/postman/scripts/test_examples

需要 登录 後方可回應,如果你還沒有帳號按這裡 注册