2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

Fixing set config.method after mergeConfig for Axios.prototype.request (#2383)

Inside Axios.prototype.request function, It's forced to set
method to 'get' after `mergeConfig` if config.method exists, which makes the defaults.method not effective.
This commit is contained in:
bushuai
2019-09-07 01:23:55 +08:00
committed by Felipe Martins
parent 89bd3abe9a
commit e50a08b2c3
+9 -1
View File
@@ -35,7 +35,15 @@ Axios.prototype.request = function request(config) {
}
config = mergeConfig(this.defaults, config);
config.method = config.method ? config.method.toLowerCase() : 'get';
// Set config.method
if (config.method) {
config.method = config.method.toLowerCase();
} else if (this.defaults.method) {
config.method = this.defaults.method.toLowerCase();
} else {
config.method = 'get';
}
// Hook up interceptors middleware
var chain = [dispatchRequest, undefined];