我遇到的情况是我写了两个具有相同端点的交互。 即使我在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",
}
}
有人可以帮助我找到满足此要求的方法吗?
谢谢!
答案 0 :(得分:2)
我怀疑您的两个请求具有相同的名称,由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", } }