mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
Fixing instance.defaults.headers type (#4557)
* Fixing instance.defaults.headers type * remove console.log() Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Vendored
+6
@@ -241,6 +241,12 @@ export class Axios {
|
||||
export interface AxiosInstance extends Axios {
|
||||
(config: AxiosRequestConfig): AxiosPromise;
|
||||
(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||
|
||||
defaults: Omit<AxiosDefaults, 'headers'> & {
|
||||
headers: HeadersDefaults & {
|
||||
[key: string]: string | number | boolean | undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export interface GenericFormData {
|
||||
|
||||
@@ -251,6 +251,8 @@ instance1.post('/user', { foo: 'bar' }, { headers: { 'X-FOO': 'bar' } })
|
||||
|
||||
// Defaults
|
||||
|
||||
axios.defaults.headers['X-FOO'];
|
||||
|
||||
axios.defaults.baseURL = 'https://api.example.com/';
|
||||
axios.defaults.headers.common['Authorization'] = 'token';
|
||||
axios.defaults.headers.post['X-FOO'] = 'bar';
|
||||
|
||||
Reference in New Issue
Block a user