@ekhein/http-request 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +1 -0
- package/package.json +1 -1
- package/types/axios.d.ts +3 -40
- package/types/http-request.d.ts +39 -0
package/dist/main.d.ts
CHANGED
package/package.json
CHANGED
package/types/axios.d.ts
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CookieJar } from "tough-cookie"
|
|
1
|
+
import { ExtendAxiosRequestConfig } from "./http-request"
|
|
3
2
|
|
|
4
3
|
declare module "axios" {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[key: string]: any
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface LiuGuanProxyOptions {
|
|
11
|
-
adcode?: string
|
|
12
|
-
visitorId?: string
|
|
13
|
-
unbindTime?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface Phone4GProxyOptions {
|
|
17
|
-
clientIp: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface AxiosServiceTypes {
|
|
21
|
-
NATIVE: 1
|
|
22
|
-
SEKIRO: 2
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface AxiosRequestConfig extends AxiosRequestAnyConfig{
|
|
26
|
-
form?: any
|
|
27
|
-
body?: any
|
|
28
|
-
html?: boolean
|
|
29
|
-
resolveBodyOnly?: boolean
|
|
30
|
-
retryLimit?: number
|
|
31
|
-
serviceType?: AxiosServiceTypes[keyof AxiosServiceTypes]
|
|
32
|
-
useProxy?: boolean | LiuGuanProxyOptions | Phone4GProxyOptions
|
|
33
|
-
jar?: CookieJar
|
|
34
|
-
interceptorHooks?: {
|
|
35
|
-
requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>
|
|
36
|
-
requestInterceptorCatch?: (error: any) => any
|
|
37
|
-
respondInterceptor?: (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse | any>
|
|
38
|
-
respondInterceptorCatch?: (error: any) => any
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}
|
|
4
|
+
interface AxiosRequestConfig extends ExtendAxiosRequestConfig {}
|
|
5
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from "axios"
|
|
2
|
+
import { CookieJar } from "tough-cookie"
|
|
3
|
+
|
|
4
|
+
export interface HttpLiuGuanProxy {
|
|
5
|
+
adcode?: string
|
|
6
|
+
visitorId?: string
|
|
7
|
+
unbindTime?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface HttpPhone4GProxy {
|
|
11
|
+
clientIp: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface HttpServiceTypes {
|
|
15
|
+
NATIVE: 1
|
|
16
|
+
SEKIRO: 2
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ExtendAxiosRequestConfig extends Record<string, any> {
|
|
20
|
+
form?: any
|
|
21
|
+
body?: any
|
|
22
|
+
html?: boolean
|
|
23
|
+
resolveBodyOnly?: boolean
|
|
24
|
+
retryLimit?: number
|
|
25
|
+
serviceType?: HttpServiceTypes[keyof HttpServiceTypes]
|
|
26
|
+
useProxy?: boolean | HttpLiuGuanProxy | HttpPhone4GProxy
|
|
27
|
+
jar?: CookieJar
|
|
28
|
+
interceptorHooks?: {
|
|
29
|
+
requestInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>
|
|
30
|
+
requestInterceptorCatch?: (error: any) => any
|
|
31
|
+
respondInterceptor?: (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse | any>
|
|
32
|
+
respondInterceptorCatch?: (error: any) => any
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface HttpRequestConfig extends AxiosRequestConfig, ExtendAxiosRequestConfig {
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|