使用Postman进行Base64解码
打开Postman新建请求
请求栏输入任意url
Scripts输入如下代码
const base64EncodedString = "aGVsbG8gd29ybGQh" ;
console.log("INPUT >> ",base64EncodedString," <<");
if(!base64EncodedString.length > 0) {
pm.test("FAIL ", () => {throw new Error(" 'base64EncodedString' can not be empty !!")});
}else{
try{
var wordArray = CryptoJS.enc.Base64.parse(base64EncodedString);
var decodedString = CryptoJS.enc.Utf8.stringify(wordArray);
console.log("OUTPUT >> ",decodedString," <<");
pm.test(decodedString,function(){});
}catch(e){
pm.test("FAIL", () => {throw new Error("Malformed 'base64EncodedString', please verify the input again.")});
}
}
然后点击Send即可