mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +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
|
||||
utils.extend(instance, context);
|
||||
|
||||
// Factory for creating new instances
|
||||
instance.create = function create(instanceConfig) {
|
||||
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
||||
};
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -31,11 +36,6 @@ var axios = createInstance(defaults);
|
||||
// Expose Axios class to allow class inheritance
|
||||
axios.Axios = Axios;
|
||||
|
||||
// Factory for creating new instances
|
||||
axios.create = function create(instanceConfig) {
|
||||
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
||||
};
|
||||
|
||||
// Expose Cancel & CancelToken
|
||||
axios.Cancel = require('./cancel/Cancel');
|
||||
axios.CancelToken = require('./cancel/CancelToken');
|
||||
|
||||
Reference in New Issue
Block a user