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

Axios adapter that allows to easily mock requests

Results 117 axios-mock-adapter issues
Sort by recently updated
recently updated
newest added

I am mocking requests that rely on CSRF tokens set in cookies. I configure `axios` as follows: ``` axios.defaults.xsrfCookieName = 'csrftoken'; axios.defaults.xsrfHeaderName = 'X-CSRFToken'; ``` These values don't seem to...

The package already has validation for request headers. However, it checks for request headers in a strict manner: ``` function isEqual(a, b) { return deepEqual(a, b, { strict: true });...

I want to check that the auth token is valid on some requests. This is working now: ```js mock.onPost('/resource').reply(config => { if (config.headers.Authorization !== 'Bearer ' + jwt) return [401];...

The Response section of the [Axios README](https://github.com/axios/axios/blob/master/README.md#response-schema) contains a subtle detail: > // `headers` the headers that the server responded with > // All header names are lower cased This...

major-version-candidate

This submission allows the user to specify whether or not to ignore query parms when matching handlers. The new parameter can be specified as follows: ``` const mock = new...

major-version-candidate

Hey, first let my thank you for this amazing library, you made axios soooo easy to mock and test! :smile: --- Today I encountered a problem when I was trying...

major-version-candidate

I have a monorepo containing a react frontend, a node backend using babel for es6 import syntax support and a common library. The common library (also using babel) has some...

```javascript const axiosMock = new MockAdapter(axios); axiosMock.onGet(`${gl.TEST_HOST}/test`).reply(200, { some: 'data' }); axios.get(`${gl.TEST_HOST}/test`) .then(response => console.log(response.request)); ``` will result in `undefined`. This makes it impossible to test code which handles multiple...

major-version-candidate

What about storing regex matches into the config object: ```js const getUser = (id) => [ 1: { name: 'Vladimir' }, 2: { name: 'Donald' }, ](id) mock .onGet(/\/api\/user\/(\d+)/) //...