一、抓取定向地址的网络请求
Proxy->Recording Settings
![](https://img.haomeiwen.com/i3614772/c463fe9ad739329a.png)
注:
若是抓取https接口 要特殊配置
1、查看钥匙串中Charles Proxy CA证书是否已经被设为“信任”,如果没有,则双击,设为“始终信任”
2、Proxy->SSL Proxying Settings
![](https://img.haomeiwen.com/i3614772/5e88dd5ad03a81ce.png)
二、对某个接口进行压测
点击链接 右键选中repeat Advanced
![](https://img.haomeiwen.com/i3614772/a6d4aa0536565193.png)
![](https://img.haomeiwen.com/i3614772/6e9f23e5958dd067.png)
三、查找功能
command + F
四、compose修改request
选中某个接口 右键点击compose
显示如下图
修改后点击Execute重新请求
![](https://img.haomeiwen.com/i3614772/5aa12fd34f5a7f8c.png)
五、rewrite修改response
需要频繁修改response则需要用rewrite
tools --> rewrite 按规则要求修改网络
六、breakpoint修改request、response
选中某个接口 右键breakpoint
重新请求该接口 会跳转至新的窗口
默认为修改request 点击execute 即为修改response
七、模拟各种网络(点亮小绿龟)
![](https://img.haomeiwen.com/i3614772/ff221d2089d7b87f.png)
![](https://img.haomeiwen.com/i3614772/7409be56f9a00dab.png)
八、map功能
![](https://img.haomeiwen.com/i3614772/cb4a64ba5dde0dd1.png)
1、Map Remote :将指定的网络请求重定向到另一个网址请求地址
2、Map Local :将指定的网络请求重定向到本地文件
选中某个接口 右键maplocal
![](https://img.haomeiwen.com/i3614772/b5abac7477d8b263.png)
选择本地的json替代原有的接口返回数据
![](https://img.haomeiwen.com/i3614772/6e74c54eb17433a5.png)
点击ok 该接口的返回的json即为自己设置的数据
九、解决乱码问题
rewrite导入如下图:export_modify_header.xml文件
注:
需更改下<host>......</host>中间的内容
![](https://img.haomeiwen.com/i3614772/b48f479d68f32b9a.png)
网友评论