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:
+9
-1
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user