mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +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 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 {
|
declare class AxiosHeaders {
|
||||||
constructor(
|
constructor(
|
||||||
headers?: RawAxiosHeaders | AxiosHeaders
|
headers?: RawAxiosHeaders | AxiosHeaders
|
||||||
@@ -41,7 +47,7 @@ declare class AxiosHeaders {
|
|||||||
|
|
||||||
static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): 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(parser?: RegExp): RegExpExecArray | null;
|
||||||
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||||
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
||||||
@@ -200,16 +206,14 @@ type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;
|
|||||||
declare namespace axios {
|
declare namespace axios {
|
||||||
type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;
|
||||||
|
|
||||||
type CommonRequestHeadersList = 'Accept' | 'Content-Type' | 'Content-Length' | 'User-Agent'| 'Content-Encoding';
|
|
||||||
|
|
||||||
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
||||||
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
||||||
|
} & {
|
||||||
|
'Content-Type': ContentType
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
||||||
|
|
||||||
type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
|
||||||
|
|
||||||
type RawCommonResponseHeaders = {
|
type RawCommonResponseHeaders = {
|
||||||
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
[Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
||||||
} & {
|
} & {
|
||||||
|
|||||||
Vendored
+6
-2
@@ -42,7 +42,7 @@ export class AxiosHeaders {
|
|||||||
|
|
||||||
static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): 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(parser?: RegExp): RegExpExecArray | null;
|
||||||
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
||||||
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
||||||
@@ -75,10 +75,14 @@ export class AxiosHeaders {
|
|||||||
[Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
|
[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 & {
|
export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
||||||
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
[Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
||||||
|
} & {
|
||||||
|
'Content-Type': ContentType
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
||||||
|
|||||||
@@ -190,6 +190,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commitlint": {
|
"commitlint": {
|
||||||
|
"rules": {
|
||||||
|
"header-max-length": [
|
||||||
|
2,
|
||||||
|
"always",
|
||||||
|
130
|
||||||
|
]
|
||||||
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"@commitlint/config-conventional"
|
"@commitlint/config-conventional"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user