I need to mock the same request, that is initiated by 2 different origins (url1, url2). But the only one request (from 1st origin url1) is mocked. How to work with multiple origins? Thanks in advance.
const urlRegExp = new RegExp('/events');
const mock = RequestMock()
.onRequestTo(urlRegExp)
.respond({eenter code hererror: 'this request has been mocked'}, 500, {
'access-control-allow-origin': 'url1.com',
'access-control-allow-credentials': true
})
.onRequestTo(urlRegExp)
.respond({error: 'this request has been mocked'}, 500, {
'access-control-allow-origin': 'url2.com',
'access-control-allow-credentials': true
});
Aucun commentaire:
Enregistrer un commentaire