解决捕获到响应结果无法被序列化的请求报错问题

This commit is contained in:
zy7y 2021-05-23 15:03:53 +08:00 committed by GitHub
parent 780561777a
commit c1346cafc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -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)