Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何在cypress中拦截GetById?_Angular_Typescript_Cypress - Fatal编程技术网

Angular 如何在cypress中拦截GetById?

Angular 如何在cypress中拦截GetById?,angular,typescript,cypress,Angular,Typescript,Cypress,我目前正在cypress中截取一个Get api,它工作正常: cy.intercept('GET','/api/products', { body: list, }); 现在,我希望能够截获GetById-我尝试了下面的方法,但它不起作用,它仍然认为上面的代码是一个get all: cy.intercept('GET','/api/products/1234', { body: list, }); 有没有办法在cypress中截取带有参数的URL?为了解决这个问题,我必须更

我目前正在cypress中截取一个Get api,它工作正常:

cy.intercept('GET','/api/products', {
    body: list,
});
现在,我希望能够截获GetById-我尝试了下面的方法,但它不起作用,它仍然认为上面的代码是一个get all:

cy.intercept('GET','/api/products/1234', {
    body: list,
});

有没有办法在cypress中截取带有参数的URL?

为了解决这个问题,我必须更新到cypress 7.0.1。在最新版本的cypress中,url的检查更加严格