diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts index 040994531b..50e2388624 100644 --- a/axios/axios-tests.ts +++ b/axios/axios-tests.ts @@ -91,3 +91,9 @@ var repoSum = (repo1: Axios.AxiosXHR, repo2: Axios.AxiosXHR([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum)); + +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'; + +axiosInstance.defaults.headers.common['Authorization'] = "AUTH_TOKEN"; \ No newline at end of file diff --git a/axios/axios.d.ts b/axios/axios.d.ts index 44083f7960..9c4705d093 100644 --- a/axios/axios.d.ts +++ b/axios/axios.d.ts @@ -124,6 +124,18 @@ declare namespace Axios { data?: T; } + interface AxiosXHRConfigDefaults extends AxiosXHRConfigBase { + /** + * custom headers to be sent + */ + headers: { + common: {[index: string]: string}; + patch: {[index: string]: string}; + post: {[index: string]: string}; + put: {[index: string]: string}; + }; + } + /** * - expected response type, * - request body data type @@ -223,6 +235,11 @@ declare namespace Axios { */ interceptors: Interceptor; + /** + * Config defaults + */ + defaults: AxiosXHRConfigDefaults; + /** * equivalent to `Promise.all` */