mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Allow create() to be used recursively (#2795)
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
+5
-5
@@ -22,6 +22,11 @@ function createInstance(defaultConfig) {
|
|||||||
// Copy context to instance
|
// Copy context to instance
|
||||||
utils.extend(instance, context);
|
utils.extend(instance, context);
|
||||||
|
|
||||||
|
// Factory for creating new instances
|
||||||
|
instance.create = function create(instanceConfig) {
|
||||||
|
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
||||||
|
};
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,11 +36,6 @@ var axios = createInstance(defaults);
|
|||||||
// Expose Axios class to allow class inheritance
|
// Expose Axios class to allow class inheritance
|
||||||
axios.Axios = Axios;
|
axios.Axios = Axios;
|
||||||
|
|
||||||
// Factory for creating new instances
|
|
||||||
axios.create = function create(instanceConfig) {
|
|
||||||
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
|
||||||
};
|
|
||||||
|
|
||||||
// Expose Cancel & CancelToken
|
// Expose Cancel & CancelToken
|
||||||
axios.Cancel = require('./cancel/Cancel');
|
axios.Cancel = require('./cancel/Cancel');
|
||||||
axios.CancelToken = require('./cancel/CancelToken');
|
axios.CancelToken = require('./cancel/CancelToken');
|
||||||
|
|||||||
Reference in New Issue
Block a user