Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Zzet-Z opened this issue Mar 21, 2024 · 3 comments
Closed

Comments

@Zzet-Z
Copy link

Zzet-Z commented Mar 21, 2024

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

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

@avwo
Copy link
Owner

avwo commented Mar 22, 2024

应用场景是什么?
可以用插件实现,并提供 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
Copy link
Author

Zzet-Z commented Mar 22, 2024

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

@avwo
Copy link
Owner

avwo commented Mar 22, 2024

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

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

@avwo avwo closed this as completed Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants