Feature request:

This issue has been tracked since 2017-02-05.

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,
mrjacobbloom wrote this answer on 2020-01-16

As a workaround, you can use a getter for response:

moxios.stubRequest('/say/hello', {
  status: 200,
  get response() {
    const data = {/* ... */};
    return data;
More Details About Repo
Owner Name axios
Repo Name moxios
Full Name axios/moxios
Language JavaScript
Created Date 2016-05-25
Updated Date 2022-12-05
Star Count 1386
Watcher Count 20
Fork Count 85
Issue Count 19


Issue Title Created Date Updated Date