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)
@@ -277,15 +277,15 @@ If you set `onNoMatch` option to `passthrough` all requests would be forwarded o
277
277
```js
278
278
// Mock all requests to /foo with HTTP 200, but forward
279
279
// any others requests to server
280
-
var mock =newMockAdapter(axiosInstance, { onNoMatch:"passthrough" });
280
+
var mock =newAxiosMockAdapter(axiosInstance, { onNoMatch:"passthrough" });
281
281
282
282
mock.onAny("/foo").reply(200);
283
283
```
284
284
285
285
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.
286
286
287
287
```js
288
-
var mock =newMockAdapter(axiosInstance, { onNoMatch:"throwException" });
288
+
var mock =newAxiosMockAdapter(axiosInstance, { onNoMatch:"throwException" });
289
289
290
290
mock.onAny("/foo").reply(200);
291
291
@@ -323,7 +323,7 @@ Composing from multiple sources with Promises:
0 commit comments