A有一个页面,它在呈现时发送多个HTTP get数据请求。如何过滤moxios.requests,以获取某个URL的请求进行响应?
我在网上能找到的唯一方法是moxios.requests.mostRecent(),但是我不确定最近的请求是什么。即便如此,还有其他方法可以弹出另一个请求吗?
在moxios库上似乎没有任何关于这方面的文档:https://github.com/axios/moxios
let request = moxios.requests.mostRecent() // How to get 'some/url/' here? This expect is currently failing
expect(request.url).to.equal('some/url/')
request.respondWith({
status: 200,
response: []
}发布于 2018-03-15 02:22:55
您可以按索引访问请求,如下所示:第一个请求为moxios.requests.at(0),下一个为moxios.requests.at(1),依此类推。我在这里找到了:https://github.com/axios/moxios/issues/10
https://stackoverflow.com/questions/48160592
复制相似问题