Skip to content

Commit

Permalink
Fixing set config.method after mergeConfig for Axios.prototype.request
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bushuai committed Sep 6, 2019
1 parent 89bd3ab commit 735f99b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/core/Axios.js
Expand Up @@ -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];
Expand Down

0 comments on commit 735f99b

Please sign in to comment.