avwo / whistle

HTTP, HTTP2, HTTPS, Websocket debugging proxy
https://wproxy.org/
MIT License
14.27k stars 1.08k forks source link

【需求】对请求设置命中次数,重新打开规则时刷新次数。 #1053

Closed Zzet-Z closed 6 months ago

Zzet-Z commented 6 months ago

我翻阅了帮助文档,尝试搜索了大多数章节,但是没有找到可以增加命中次数的功能,所以期望可以加一个命中次数的逻辑。

像是这样 /api/data/ resBody://{data.json} times://1

avwo commented 6 months ago

应用场景是什么? 可以用插件实现,并提供 UI 手动清理 session,参考:

  1. 动态设置规则:https://github.com/whistle-plugins/examples/blob/master/whistle.test-rules/lib/rulesServer.js
  2. 插件交互界面:https://github.com/whistle-plugins/examples/tree/master/whistle.test-ui
Zzet-Z commented 6 months ago

好的,感谢!我试试。 使用场景是一个页面同时调了3次相同的接口,但我只想模拟第一次的返回。

avwo commented 6 months ago

如果只是匹配第一次返回可以结合 cookie 按如下处理,但每次请求结束需要手动删除指定 cookie

*/api/data/ resBody://{data.json} excludeFilter://reqH:cookie=req_timers=1 reqCookies://req_timers=1