赞
踩
场景: 获取验证码接口, 使用postman调用, 期望看到验证码图片, 但是图片是stream流
实现: 先把stream转为base64, 再展示
-
- pm.test("获取验证码后, 展示验证码", function () {
- var temp = pm.response.stream.toString("base64");
-
- var template = `<html><img src="data:image/jpg;base64,`+ temp +`" /></html>`;
-
- pm.visualizer.set(template, data);// postman可视化
- });
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。