2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

Clean up PR

This commit is contained in:
Martti Laine
2018-03-09 13:58:08 +02:00
parent 5bfd2ea9f6
commit d78204712a
3 changed files with 26 additions and 38 deletions
+3 -7
View File
@@ -23,21 +23,17 @@ function Axios(instanceConfig) {
* @param {Object} config The config specific for this request (merged with this.defaults)
*/
Axios.prototype.request = function request(config) {
config = config || {};
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof config === 'string') {
config = arguments[1] || {};
config.url = arguments[0];
}
if (!config.method) {
config.method = 'get';
} else {
config = config || {};
}
config = utils.mergeConfig(this.defaults, config);
config.method = config.method.toLowerCase();
config.method = config.method ? config.method.toLowerCase() : 'get';
// Hook up interceptors middleware
var chain = [dispatchRequest, undefined];