1.使用断点方式:
1)在需要修改返回值的链接处点击右键,勾选Breakpoints。
2)客户端进行相关操作(已配置代理)
3)这时如果请求打了断点的接口,chales就会停在如下页面:

4)点击Edit Response选项,在JSON Text框中修改想要修改的值。再点击Execute,接口就会返回修改后的值。

2.使用Rewrite方式:
1)在Tools中勾选Rewrite,进入Rewrite Settings页面,在页面左侧下方点击add,增加一个要重写的接口条目,点击这个接口条目,在右侧添加location及rule。在location中选择协议,填写Host、Port、Path、Query参数。在Rewrite Rule中选择要修改的Type,Where中选择要自改请求还是返回,Match的value填写要改变的值,Replace的value填写修改后的值。这样每次请求这个接口,就会自动返回修改后的值。



网友评论