Open
Description
Hi
I'm having an issue with requests completed after cleaning mocks
$.mockjax({
url: '/hello',
responseTime: 10000,
responseText: "whatever"
});
$.get('/hello', function () {
console.log('I don't expect to get here');
});
$.mockjax.clear();
The request is already in progress when I clear mockjax, but all clear does is prevent other request from starting. The ones already in progress cannot be stopped.
Do you have any suggestions?
Best would be implement #184 and handle this case in the clear
or dispose
. A quicker approach would be to keep track of pending requests.
I can't do it from my code because .response
is called after responseTime
and there's no event onBeforeRequest
or beforeSend
.
$.mockjax.mockedAjaxCalls()
gets close to my need, but it only contains a list of requests, there's no reference to mockRequest = _ajax.call()
. I could do with a $.mockjax.mockedAjaxRequests()
but this method is not available.