You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This sets the mock adapter on the default instance
47
-
var mock =newMockAdapter(axios);
47
+
var mock =newAxiosMockAdapter(axios);
48
48
49
49
// Mock GET request to /users when param `searchText` is 'John'
50
50
// arguments for reply are (status, data, headers)
@@ -65,7 +65,7 @@ To add a delay to responses, specify a delay amount (in milliseconds) when insta
65
65
66
66
```js
67
67
// All requests using this instance will have a 2 seconds delay:
68
-
var mock =newMockAdapter(axiosInstance, { delayResponse:2000 });
68
+
var mock =newAxiosMockAdapter(axiosInstance, { delayResponse:2000 });
69
69
```
70
70
71
71
You can restore the original adapter (which will remove the mocking behavior)
@@ -279,15 +279,15 @@ If you set `onNoMatch` option to `passthrough` all requests would be forwarded o
279
279
```js
280
280
// Mock all requests to /foo with HTTP 200, but forward
281
281
// any others requests to server
282
-
var mock =newMockAdapter(axiosInstance, { onNoMatch:"passthrough" });
282
+
var mock =newAxiosMockAdapter(axiosInstance, { onNoMatch:"passthrough" });
283
283
284
284
mock.onAny("/foo").reply(200);
285
285
```
286
286
287
287
Using `onNoMatch` option with `throwException` to throw an exception when a request is made without match any handler. It's helpful to debug your test mocks.
288
288
289
289
```js
290
-
var mock =newMockAdapter(axiosInstance, { onNoMatch:"throwException" });
290
+
var mock =newAxiosMockAdapter(axiosInstance, { onNoMatch:"throwException" });
291
291
292
292
mock.onAny("/foo").reply(200);
293
293
@@ -325,7 +325,7 @@ Composing from multiple sources with Promises:
0 commit comments