2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

fix(types): renamed RawAxiosRequestConfig back to AxiosRequestConfig; (#5486)

This commit is contained in:
Dmitriy Mozgovoy
2023-01-23 01:09:18 +02:00
committed by GitHub
parent 6486929f70
commit 2a71f49bc6
4 changed files with 115 additions and 102 deletions
+46 -43
View File
@@ -4,13 +4,9 @@ interface RawAxiosHeaders {
[key: string]: AxiosHeaderValue;
}
type MethodsHeaders = {
type MethodsHeaders = Partial<{
[Key in axios.Method as Lowercase<Key>]: AxiosHeaders;
};
interface CommonHeaders {
common: AxiosHeaders;
}
} & {common: AxiosHeaders}>;
type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
@@ -79,12 +75,12 @@ declare class AxiosError<T = unknown, D = any> extends Error {
constructor(
message?: string,
code?: string,
config?: axios.AxiosRequestConfig<D>,
config?: axios.InternalAxiosRequestConfig<D>,
request?: any,
response?: axios.AxiosResponse<T, D>
);
config?: axios.AxiosRequestConfig<D>;
config?: axios.InternalAxiosRequestConfig<D>;
code?: string;
request?: any;
response?: axios.AxiosResponse<T, D>;
@@ -110,24 +106,24 @@ declare class CanceledError<T> extends AxiosError<T> {
}
declare class Axios {
constructor(config?: axios.RawAxiosRequestConfig);
constructor(config?: axios.AxiosRequestConfig);
defaults: axios.AxiosDefaults;
interceptors: {
request: axios.AxiosInterceptorManager<axios.AxiosRequestConfig>;
request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig>;
response: axios.AxiosInterceptorManager<axios.AxiosResponse>;
};
getUri(config?: axios.RawAxiosRequestConfig): string;
request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.RawAxiosRequestConfig<D>): Promise<R>;
get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.RawAxiosRequestConfig<D>): Promise<R>;
getUri(config?: axios.AxiosRequestConfig): string;
request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.AxiosRequestConfig<D>): Promise<R>;
get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;
post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;
}
declare enum HttpStatusCode {
@@ -203,30 +199,34 @@ declare namespace axios {
type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent'| 'Content-Encoding';
type RawCommonRequestHeaders = {
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
}>;
type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
type RawCommonResponseHeaders = {
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
} & {
"set-cookie": string[];
};
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>;
type AxiosRequestHeaders = Partial<RawCommonRequestHeaders & RawAxiosHeaders> & AxiosHeaders;
type RawAxiosResponseHeaders = Partial<Record<string, string> & {
"set-cookie"?: string[]
}>;
type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
interface AxiosRequestTransformer {
(this: AxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
(this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
}
interface AxiosResponseTransformer {
(this: AxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
(this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
}
interface AxiosAdapter {
(config: AxiosRequestConfig): AxiosPromise;
(config: InternalAxiosRequestConfig): AxiosPromise;
}
interface AxiosBasicCredentials {
@@ -355,13 +355,13 @@ declare namespace axios {
type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
interface RawAxiosRequestConfig<D = any> {
interface AxiosRequestConfig<D = any> {
url?: string;
method?: Method | string;
baseURL?: string;
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
headers?: RawAxiosRequestHeaders | AxiosHeaders;
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
params?: any;
paramsSerializer?: ParamsSerializerOptions;
data?: D;
@@ -397,7 +397,10 @@ declare namespace axios {
formSerializer?: FormSerializerOptions;
}
interface AxiosRequestConfig<D = any> extends RawAxiosRequestConfig {
// Alias
type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig {
headers: AxiosRequestHeaders;
}
@@ -415,11 +418,11 @@ declare namespace axios {
unlink?: RawAxiosRequestHeaders;
}
interface AxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
headers: HeadersDefaults;
}
interface CreateAxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
}
@@ -428,7 +431,7 @@ declare namespace axios {
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
config: AxiosRequestConfig<D>;
config: InternalAxiosRequestConfig<D>;
request?: any;
}
@@ -443,7 +446,7 @@ declare namespace axios {
}
interface Canceler {
(message?: string, config?: RawAxiosRequestConfig, request?: any): void;
(message?: string, config?: AxiosRequestConfig, request?: any): void;
}
interface CancelTokenStatic {
@@ -464,7 +467,7 @@ declare namespace axios {
interface AxiosInterceptorOptions {
synchronous?: boolean;
runWhen?: (config: AxiosRequestConfig) => boolean;
runWhen?: (config: InternalAxiosRequestConfig) => boolean;
}
interface AxiosInterceptorManager<V> {
@@ -474,8 +477,8 @@ declare namespace axios {
}
interface AxiosInstance extends Axios {
<T = any, R = AxiosResponse<T>, D = any>(config: RawAxiosRequestConfig<D>): Promise<R>;
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
defaults: Omit<AxiosDefaults, 'headers'> & {
headers: HeadersDefaults & {
Vendored
+47 -44
View File
@@ -5,13 +5,9 @@ interface RawAxiosHeaders {
[key: string]: AxiosHeaderValue;
}
type MethodsHeaders = {
type MethodsHeaders = Partial<{
[Key in Method as Lowercase<Key>]: AxiosHeaders;
};
interface CommonHeaders {
common: AxiosHeaders;
}
} & {common: AxiosHeaders}>;
type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
@@ -78,30 +74,34 @@ export class AxiosHeaders {
type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent'| 'Content-Encoding';
type RawCommonRequestHeaders = {
export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
}>;
export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
type RawCommonResponseHeaders = {
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
} & {
"set-cookie": string[];
};
export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>;
export type AxiosRequestHeaders = Partial<RawCommonRequestHeaders & RawAxiosHeaders> & AxiosHeaders;
export type RawAxiosResponseHeaders = Partial<Record<string, string> & {
"set-cookie"?: string[]
}>;
export type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
export interface AxiosRequestTransformer {
(this: AxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
(this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
}
export interface AxiosResponseTransformer {
(this: AxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
(this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
}
export interface AxiosAdapter {
(config: AxiosRequestConfig): AxiosPromise;
(config: InternalAxiosRequestConfig): AxiosPromise;
}
export interface AxiosBasicCredentials {
@@ -296,13 +296,13 @@ type AxiosAdapterName = 'xhr' | 'http' | string;
type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
export interface RawAxiosRequestConfig<D = any> {
export interface AxiosRequestConfig<D = any> {
url?: string;
method?: Method | string;
baseURL?: string;
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
headers?: RawAxiosRequestHeaders | AxiosHeaders;
headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
params?: any;
paramsSerializer?: ParamsSerializerOptions;
data?: D;
@@ -338,7 +338,10 @@ export interface RawAxiosRequestConfig<D = any> {
formSerializer?: FormSerializerOptions;
}
export interface AxiosRequestConfig<D = any> extends RawAxiosRequestConfig<D> {
// Alias
export type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
export interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
headers: AxiosRequestHeaders;
}
@@ -356,11 +359,11 @@ export interface HeadersDefaults {
unlink?: RawAxiosRequestHeaders;
}
export interface AxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
headers: HeadersDefaults;
}
export interface CreateAxiosDefaults<D = any> extends Omit<RawAxiosRequestConfig<D>, 'headers'> {
export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
}
@@ -369,7 +372,7 @@ export interface AxiosResponse<T = any, D = any> {
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
config: AxiosRequestConfig<D>;
config: InternalAxiosRequestConfig<D>;
request?: any;
}
@@ -377,12 +380,12 @@ export class AxiosError<T = unknown, D = any> extends Error {
constructor(
message?: string,
code?: string,
config?: AxiosRequestConfig<D>,
config?: InternalAxiosRequestConfig<D>,
request?: any,
response?: AxiosResponse<T, D>
);
config?: AxiosRequestConfig<D>;
config?: InternalAxiosRequestConfig<D>;
code?: string;
request?: any;
response?: AxiosResponse<T, D>;
@@ -393,7 +396,7 @@ export class AxiosError<T = unknown, D = any> extends Error {
static from<T = unknown, D = any>(
error: Error | unknown,
code?: string,
config?: AxiosRequestConfig<D>,
config?: InternalAxiosRequestConfig<D>,
request?: any,
response?: AxiosResponse<T, D>,
customProps?: object,
@@ -426,7 +429,7 @@ export interface Cancel {
}
export interface Canceler {
(message?: string, config?: RawAxiosRequestConfig, request?: any): void;
(message?: string, config?: AxiosRequestConfig, request?: any): void;
}
export interface CancelTokenStatic {
@@ -447,7 +450,7 @@ export interface CancelTokenSource {
export interface AxiosInterceptorOptions {
synchronous?: boolean;
runWhen?: (config: AxiosRequestConfig) => boolean;
runWhen?: (config: InternalAxiosRequestConfig) => boolean;
}
export interface AxiosInterceptorManager<V> {
@@ -457,29 +460,29 @@ export interface AxiosInterceptorManager<V> {
}
export class Axios {
constructor(config?: RawAxiosRequestConfig);
constructor(config?: AxiosRequestConfig);
defaults: AxiosDefaults;
interceptors: {
request: AxiosInterceptorManager<AxiosRequestConfig>;
request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
response: AxiosInterceptorManager<AxiosResponse>;
};
getUri(config?: RawAxiosRequestConfig): string;
request<T = any, R = AxiosResponse<T>, D = any>(config: RawAxiosRequestConfig<D>): Promise<R>;
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: RawAxiosRequestConfig<D>): Promise<R>;
getUri(config?: AxiosRequestConfig): string;
request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
}
export interface AxiosInstance extends Axios {
<T = any, R = AxiosResponse<T>, D = any>(config: RawAxiosRequestConfig<D>): Promise<R>;
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: RawAxiosRequestConfig<D>): Promise<R>;
<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
defaults: Omit<AxiosDefaults, 'headers'> & {
headers: HeadersDefaults & {
+15 -8
View File
@@ -1,6 +1,6 @@
import axios = require('axios');
const config: axios.RawAxiosRequestConfig = {
const config: axios.AxiosRequestConfig = {
url: '/user',
method: 'get',
baseURL: 'https://api.example.com/',
@@ -38,11 +38,11 @@ const config: axios.RawAxiosRequestConfig = {
cancelToken: new axios.CancelToken((cancel: axios.Canceler) => {})
};
const nullValidateStatusConfig: axios.RawAxiosRequestConfig = {
const nullValidateStatusConfig: axios.AxiosRequestConfig = {
validateStatus: null
};
const undefinedValidateStatusConfig: axios.RawAxiosRequestConfig = {
const undefinedValidateStatusConfig: axios.AxiosRequestConfig = {
validateStatus: undefined
};
@@ -276,19 +276,19 @@ axios.create({
// Interceptors
const requestInterceptorId: number = axios.interceptors.request.use(
(config: axios.AxiosRequestConfig) => config,
(config: axios.InternalAxiosRequestConfig) => config,
(error: any) => Promise.reject(error)
);
axios.interceptors.request.eject(requestInterceptorId);
axios.interceptors.request.use(
(config: axios.AxiosRequestConfig) => Promise.resolve(config),
(config: axios.InternalAxiosRequestConfig) => Promise.resolve(config),
(error: any) => Promise.reject(error)
);
axios.interceptors.request.use((config: axios.AxiosRequestConfig) => config);
axios.interceptors.request.use((config: axios.AxiosRequestConfig) => Promise.resolve(config));
axios.interceptors.request.use((config: axios.InternalAxiosRequestConfig) => config);
axios.interceptors.request.use((config: axios.InternalAxiosRequestConfig) => Promise.resolve(config));
const responseInterceptorId: number = axios.interceptors.response.use(
(response: axios.AxiosResponse) => response,
@@ -302,6 +302,13 @@ axios.interceptors.response.use(
(error: any) => Promise.reject(error)
);
axios.interceptors.request.use(req => {
// https://github.com/axios/axios/issues/5415
req.headers.set('foo', 'bar');
req.headers['Content-Type'] = 123;
return req;
});
const voidRequestInterceptorId = axios.interceptors.request.use(
// @ts-expect-error -- Must return an axios.AxiosRequestConfig (or throw)
(_response) => {},
@@ -323,7 +330,7 @@ axios.interceptors.response.clear();
// Adapters
const adapter: axios.AxiosAdapter = (config: axios.AxiosRequestConfig) => {
const adapter: axios.AxiosAdapter = (config: axios.InternalAxiosRequestConfig) => {
const response: axios.AxiosResponse = {
data: { foo: 'bar' },
status: 200,
+7 -7
View File
@@ -1,5 +1,5 @@
import axios, {
RawAxiosRequestConfig,
InternalAxiosRequestConfig,
AxiosRequestConfig,
AxiosHeaders,
AxiosRequestHeaders,
@@ -22,7 +22,7 @@ import axios, {
spread
} from 'axios';
const config: RawAxiosRequestConfig = {
const config: AxiosRequestConfig = {
url: '/user',
method: 'get',
baseURL: 'https://api.example.com/',
@@ -60,11 +60,11 @@ const config: RawAxiosRequestConfig = {
cancelToken: new axios.CancelToken((cancel: Canceler) => {})
};
const nullValidateStatusConfig: RawAxiosRequestConfig = {
const nullValidateStatusConfig: AxiosRequestConfig = {
validateStatus: null
};
const undefinedValidateStatusConfig: RawAxiosRequestConfig = {
const undefinedValidateStatusConfig: AxiosRequestConfig = {
validateStatus: undefined
};
@@ -515,7 +515,7 @@ axios.get('/user', {
// issue #5034
function getRequestConfig1(options: RawAxiosRequestConfig): RawAxiosRequestConfig {
function getRequestConfig1(options: AxiosRequestConfig): AxiosRequestConfig {
return {
...options,
headers: {
@@ -525,7 +525,7 @@ function getRequestConfig1(options: RawAxiosRequestConfig): RawAxiosRequestConfi
};
}
function getRequestConfig2(options: RawAxiosRequestConfig): RawAxiosRequestConfig {
function getRequestConfig2(options: AxiosRequestConfig): AxiosRequestConfig {
return {
...options,
headers: {
@@ -609,7 +609,7 @@ for (const [header, value] of headers) {
config.headers.foo = "1";
config.headers.set('bar', '2');
config.headers.set({myHeader: "myValue"})
config.headers = new axios.AxiosHeaders({myHeader: "myValue"});
config.headers = new AxiosHeaders({myHeader: "myValue"});
config.headers = {...config.headers} as AxiosRequestHeaders;
return config;
},