Feature request:
miljan-aleksic opened this issue · comments
Miljan commented
Hi, I'm using Moxios to build a live demo of SPA project and while was able to do so, its not really strightforward.
I would like to request a function similar to stubRequest with a callback.
moxios.stubRequest('/say/hello', request => {
const data = {} // do your thing
return {
status: 200,
data
}
})
Jacob commented
As a workaround, you can use a getter for response:
moxios.stubRequest('/say/hello', {
status: 200,
get response() {
const data = {/* ... */};
return data;
}
});