mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
fix response headers types (#4136)
* fix response headers types some keys like 'set-cookie' are arrays https://github.com/axios/axios/blob/master/lib/helpers/parseHeaders.js#L45 * split header types
This commit is contained in:
Vendored
+16
-6
@@ -1,5 +1,15 @@
|
|||||||
export interface AxiosTransformer {
|
export type AxiosRequestHeaders = Record<string, string>
|
||||||
(data: any, headers?: Record<string, string>): any;
|
|
||||||
|
export type AxiosResponseHeaders = Record<string, string> & {
|
||||||
|
"set-cookie"?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosRequestTransformer {
|
||||||
|
(data: any, headers?: AxiosRequestHeaders): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AxiosResponseTransformer {
|
||||||
|
(data: any, headers?: AxiosResponseHeaders): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AxiosAdapter {
|
export interface AxiosAdapter {
|
||||||
@@ -51,9 +61,9 @@ export interface AxiosRequestConfig<D = any> {
|
|||||||
url?: string;
|
url?: string;
|
||||||
method?: Method;
|
method?: Method;
|
||||||
baseURL?: string;
|
baseURL?: string;
|
||||||
transformRequest?: AxiosTransformer | AxiosTransformer[];
|
transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
||||||
transformResponse?: AxiosTransformer | AxiosTransformer[];
|
transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
||||||
headers?: Record<string, string>;
|
headers?: AxiosRequestHeaders;
|
||||||
params?: any;
|
params?: any;
|
||||||
paramsSerializer?: (params: any) => string;
|
paramsSerializer?: (params: any) => string;
|
||||||
data?: D;
|
data?: D;
|
||||||
@@ -85,7 +95,7 @@ export interface AxiosResponse<T = unknown, D = any> {
|
|||||||
data: T;
|
data: T;
|
||||||
status: number;
|
status: number;
|
||||||
statusText: string;
|
statusText: string;
|
||||||
headers: Record<string, string>;
|
headers: AxiosResponseHeaders;
|
||||||
config: AxiosRequestConfig<D>;
|
config: AxiosRequestConfig<D>;
|
||||||
request?: any;
|
request?: any;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user