我遇到的情况是我写了两个具有相同端点的交互。
即使我在with_request选项中传递了不同的查询,我也遇到了错误-

Error: Multiple interaction found for GET /a1/configurations?includeDeleted=true&


第一次互动:

withRequest: {
          method: "GET",
          path: `/a1/configurations`,
          query: {
            includeDeleted: "false",
          }
}


第二次互动:

withRequest: {
          method: "GET",
          path: `/a1/configurations`,
          query: {
            includeDeleted: "true",
          }
}


谁能帮助我找到满足此要求的方法?

感谢您 !!

最佳答案

我怀疑您的两个请求具有相同的名称,由uponReceiving设置。

该错误消息表明您的代码类似于:

uponReceiving: 'GET /a1/configurations?includeDeleted=true&'
withRequest: { ... }
uponReceiving: 'GET /a1/configurations?includeDeleted=true&'
withRequest: { ... }


如果uponReceiving详细信息不同,则withRequest的值必须唯一。

为了获得最佳实践,我建议使用人类可读的字符串(这有助于报告):

uponReceiving: 'a request for configurations that are not deleted',
withRequest: { method: "GET", path: /a1/configurations, query: { includeDeleted: "false", } }


然后:

uponReceiving: 'a request for all configurations',
withRequest: { method: "GET", path: /a1/configurations, query: { includeDeleted: "true", } }

09-20 17:21