未验证 提交 69d3cc4f 编写于 作者: I Isaac Whitfield 提交者: GitHub

Allow create() to be used recursively (#2795)

Co-authored-by: NJay <jasonsaayman@gmail.com>
上级 e367be54
......@@ -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');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册