From c1346cafc23558dc5c33233b807eb7f2143bcc07 Mon Sep 17 00:00:00 2001 From: zy7y <67154681+zy7y@users.noreply.github.com> Date: Sun, 23 May 2021 15:03:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=8D=95=E8=8E=B7=E5=88=B0?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E7=BB=93=E6=9E=9C=E6=97=A0=E6=B3=95=E8=A2=AB?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E7=9A=84=E8=AF=B7=E6=B1=82=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/recording.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/recording.py b/tools/recording.py index 8b36d80..c2bc5f7 100644 --- a/tools/recording.py +++ b/tools/recording.py @@ -6,7 +6,7 @@ @Author:zy7y @Date :2021/5/21 22:07 @Desc : 录制接口,生成用例文件 -基于mitmproxy实现 +基于mitmproxy实现,会包含css/html/png等后缀链接 参考资料: https://blog.wolfogre.com/posts/usage-of-mitmproxy/ https://www.cnblogs.com/liuwanqiu/p/10697373.html @@ -80,9 +80,12 @@ class Counter: data = url.split('?')[1] data = self.handle_form(data) # 预期结果 - expect = json.dumps( - {".": json.loads(flow.response.text)}, ensure_ascii=False) - + try: + expect = json.dumps( + {".": json.loads(flow.response.text)}, ensure_ascii=False) + except Exception as e: + ctx.log.error(e) + expect = '{}' # 日志 ctx.log.info(url) ctx.log.info(header)