postman - 在 Postman 集合中,其中一项服务只需要调用一次
问题描述
我正在设计一个相当简单的集合,集合中有两个服务:
- 请求#1:获取令牌服务
- 请求#2:获取详细信息的服务(需要以前服务的令牌)
我已经设法从服务 #1 中获取令牌并将其设置为变量,并在请求 #2 中使用所述令牌。然后,我在 Runner 中使用 csv 文件使用不同的参数调用服务 #2。
我想要实现的是只运行一次服务#1,而不是运行与 CSV 上的行数一样多的次数。可能吗?
解决方案
You can use postman.setNextRequest("request #2");
in the Tests script of request #2 to skip the execution of request #1 after the first run.
But you also need to add a condition to only do that while pm.info.iteration is smaller than your amount of required executions to avoid an endless loop.
推荐阅读
- docker - Docker Go lang SDK 从 ContainerExecCreate 不返回任何内容
- excel - 无法将数据从另一张表复制到主表。调用子副本时执行vba下标超出范围错误9
- linux - 用于读取远程 VM 上 docker 容器化应用程序日志文件的 shellscript 不起作用
- html - 表单选择大小不适用于数据库填充选项
- python-3.x - 为什么在使用 pandas、matplotlib 和 seaborn 绘制图形时会有不必要的空格?
- cockroachdb - Cockroachdb 在启动后使用了所有内存,即使数据大小只有 2GiB
- javascript - 输入标签未在 React 中呈现
- swift - SFSpeechRecognizer 失败并出现错误 kAFAssistantErrorDomain Code=1107
- java - 是否可以使用注释来禁止类中的依赖关系?
- swift - 为什么lazy.compactMap.first 映射'first'元素两次?