axios-mock-adapter
axios-mock-adapter copied to clipboard
Axios adapter that allows to easily mock requests
This works: ``` mock .onGet('/mock?address=Singapore') .reply(200, {...}); ``` But this returns `Request failed with status code 404`: ``` mock .onGet('/mock', {params: {address: 'Singapore'}}) .reply(200, {...}); ```
When I am passing an object as `data`, I still need to do `JSON.parse` as below, if I want to do something like `expect(data.x).toEqual(1);`. I am passing headers of `application/json`...
I'm trying to mock this code: ``` axiosInstance .request(originalRequest) .then(...); ``` Where `originalRequest` is an object like: ``` { headers: { }, baseURL: 'http://localhost:3000/test', method: 'get', url: '/test' } ```...
One neat feature would be a possibility to mock upload progress events. Usage for this is when mocking file upload, you normally want to give some visual feedback that something...
In Angular testing for a service that implements `$http`, we're using to doing this: ``` $httpBackend.flush(); ``` What this does is it takes any outstanding requests and processes them so...
I've used other mocking libraries in the past with other languages. One of the features I really miss is the ability to have my mocking library make my test fail...
Willing to accept a PR?
I have spent the weekend attempting to resolve this issue, and I believe this to be a bug in `axios-mock-adapter`. Having said that, if that is not the case, I...
Howdy, Thank you for this awesome project ! We ran into a bug when attempting to return a value from an intercepted get call. Our return data is fairly complicated...
I have a GET request with the url in the following format: `api/v1/rest/collection?startDate>="(ISO 8601 string)"&startDate x.startDate >= config.start && x.startDate < config.end)] }) mock.onAny().passThrough() ```