axios-mock-adapter icon indicating copy to clipboard operation
axios-mock-adapter copied to clipboard

passThrough cause axios error

Open guanyx opened this issue 8 years ago • 0 comments

// error code
import Axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
const mock = new MockAdapter(Axios);
// start mock 
mock.onAny().passThrough();
// end mock

Axios.get('/host/path')

error pic

// correct code
import Axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
const mock = new MockAdapter(Axios);
// start mock
mock.onAny().passThrough();
// end mock

const axiosIns = Axios.create();
axiosIns.get('/host/path')

guanyx avatar May 27 '17 08:05 guanyx