mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
fix(types): fixed CommonRequestHeadersList & CommonResponseHeadersList types to be private in commonJS; (#5503)
This commit is contained in:
+9
-5
@@ -10,6 +10,12 @@ type MethodsHeaders = Partial<{
|
||||
|
||||
type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean;
|
||||
|
||||
type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization';
|
||||
|
||||
type ContentType = AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';
|
||||
|
||||
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
||||
|
||||
declare class AxiosHeaders {
|
||||
constructor(
|
||||
headers?: RawAxiosHeaders | AxiosHeaders
|
||||
@@ -41,7 +47,7 @@ declare class AxiosHeaders {
|
||||
|
||||
static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
||||
|
||||
setContentType(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentType(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
||||
@@ -200,16 +206,14 @@ type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
|
||||
declare namespace axios {
|
||||
type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
||||
|
||||
type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent'| 'Content-Encoding';
|
||||
|
||||
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
||||
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
||||
} & {
|
||||
'Content-Type': ContentType
|
||||
}>;
|
||||
|
||||
type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
||||
|
||||
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
||||
|
||||
type RawCommonResponseHeaders = {
|
||||
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
||||
} & {
|
||||
|
||||
Vendored
+6
-2
@@ -42,7 +42,7 @@ export class AxiosHeaders {
|
||||
|
||||
static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
||||
|
||||
setContentType(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
||||
getContentType(parser?: RegExp): RegExpExecArray | null;
|
||||
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
||||
@@ -75,10 +75,14 @@ export class AxiosHeaders {
|
||||
[Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
|
||||
}
|
||||
|
||||
type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization';
|
||||
type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization';
|
||||
|
||||
type ContentType = AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';
|
||||
|
||||
export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
||||
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
||||
} & {
|
||||
'Content-Type': ContentType
|
||||
}>;
|
||||
|
||||
export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
||||
|
||||
+8
-1
@@ -190,8 +190,15 @@
|
||||
}
|
||||
},
|
||||
"commitlint": {
|
||||
"rules": {
|
||||
"header-max-length": [
|
||||
2,
|
||||
"always",
|
||||
130
|
||||
]
|
||||
},
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user