@ekhein/http-request 1.0.21 → 1.0.23

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ekhein/http-request",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "license": "MIT",
5
5
  "author": "ekhein",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./types/index.d.ts",
8
8
  "files": [
9
- "dist"
9
+ "dist", "types"
10
10
  ],
11
11
  "scripts": {
12
12
  "build": "tsc"
@@ -0,0 +1,5 @@
1
+ import { ExtendAxiosRequestConfig } from './http-request'
2
+
3
+ declare module "axios" {
4
+ interface AxiosRequestConfig extends ExtendAxiosRequestConfig {}
5
+ }
@@ -0,0 +1,48 @@
1
+ import { JSDOM } from 'jsdom';
2
+ import { CookieJar } from 'tough-cookie';
3
+ import { AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse, AxiosRequestHeaders } from 'axios';
4
+
5
+ export interface HttpLiuGuanProxy {
6
+ adcode?: string
7
+ visitorId?: string
8
+ unbindTime?: string
9
+ }
10
+
11
+ export interface HttpPhone4GProxy {
12
+ clientIp: string
13
+ }
14
+
15
+ export interface HttpServiceTypes {
16
+ NATIVE: 1
17
+ SEKIRO: 2
18
+ }
19
+
20
+ export interface ExtendInternalAxiosRequestConfig extends HttpRequestConfig, InternalAxiosRequestConfig {
21
+ headers: AxiosRequestHeaders;
22
+ }
23
+
24
+ export interface ExtendAxiosResponse extends AxiosResponse {
25
+ config: ExtendInternalAxiosRequestConfig
26
+ }
27
+
28
+ export interface ExtendAxiosRequestConfig extends Record<string, any> {
29
+ form?: any
30
+ body?: any
31
+ html?: boolean
32
+ resolveBodyOnly?: boolean
33
+ serviceType?: HttpServiceTypes[keyof HttpServiceTypes]
34
+ useProxy?: boolean | HttpLiuGuanProxy | HttpPhone4GProxy
35
+ jar?: CookieJar
36
+ interceptorHooks?: {
37
+ requestInterceptor?: (config: ExtendInternalAxiosRequestConfig) => ExtendInternalAxiosRequestConfig | Promise<ExtendInternalAxiosRequestConfig>
38
+ requestInterceptorCatch?: (error: any) => any
39
+ respondInterceptor?: (response: ExtendAxiosResponse) => ExtendAxiosResponse | Promise<ExtendAxiosResponse | any>
40
+ respondInterceptorCatch?: (error: any) => any
41
+ }
42
+ }
43
+
44
+ export interface HttpRequestConfig extends ExtendAxiosRequestConfig, AxiosRequestConfig {}
45
+
46
+ export interface HttpResponse extends ExtendAxiosResponse {}
47
+
48
+ export interface HTMLResponse extends JSDOM {}
@@ -0,0 +1 @@
1
+ export * from './http-request';