首页 > 解决方案 > 如何查询一些与此字段具有相同字段的 API 请求?

问题描述

API请求示例:https : //www.sbsb.com/api/v250/animals/123456789/humans/987654321 /transplant?$skip=0&$top=666&$orderby=animalAssociatedHumans/sortDate

有没有像 api/ /animals/ /humans/*/transplant?....../sortDate 这样的东西,它会捕获所有类似的 API 请求,其中包含“api”、“animals”、“humans”、“transplant”等词它 ?

我在 cy.route('Get or Post', (url request: something I need), 'fixture:file') 中使用它

标签: javascriptapicypress

解决方案


要捕获所有这些单词,请允许它们之间提供的数字,并在transplant这之后允许任何数量的东西应该起作用:

cy.route("GET", "/api/*/animals/*/humans/*/transplant/**").as("getStuff")

推荐阅读