# Config Defaults
You can specify config defaults that will be applied to every request.
# Global axios defaults
axios.defaults.baseURL = 'https://api.example.com';
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
# Custom instance defaults
// Set config defaults when creating the instance
const instance = axios.create({
baseURL: 'https://api.example.com'
});
// Alter defaults after instance has been created
instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
# Config order of precedence
Config will be merged with an order of precedence. The order is library defaults found in lib/defaults/index.js (opens new window), then defaults
property of the instance, and finally config
argument for the request. The latter will take precedence over the former. Here's an example.
+ 
关注公众号,获取验证码 !
验证码: