@ekhein/http-request 1.0.1 → 1.0.2
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 +2 -1
- package/dist/main.js +4 -0
- package/package.json +1 -1
- package/types/http-request.d.ts +11 -3
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
2
|
+
export * from './exceptions';
|
|
3
|
+
export type { HttpRequestConfig, HttpServiceTypes, HttpLiuGuanProxy, HttpPhone4GProxy, } from '../types/http-request';
|
|
2
4
|
export declare class HttpRequest {
|
|
3
5
|
readonly instance: AxiosInstance;
|
|
4
6
|
constructor(options: AxiosRequestConfig);
|
|
@@ -6,4 +8,3 @@ export declare class HttpRequest {
|
|
|
6
8
|
post<R = any>(url: string, data?: any): Promise<R>;
|
|
7
9
|
call<R = any>(path: string, data: object): Promise<R>;
|
|
8
10
|
}
|
|
9
|
-
export type { HttpRequestConfig, HttpServiceTypes, HttpLiuGuanProxy, HttpPhone4GProxy, } from '../types/http-request';
|
package/dist/main.js
CHANGED
|
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.HttpRequest = void 0;
|
|
37
40
|
const axios_1 = __importStar(require("axios"));
|
|
@@ -46,6 +49,7 @@ const agent_1 = require("./agent");
|
|
|
46
49
|
const agent_2 = require("./agent");
|
|
47
50
|
const agent_3 = require("./agent");
|
|
48
51
|
const exceptions_1 = require("./exceptions");
|
|
52
|
+
__exportStar(require("./exceptions"), exports);
|
|
49
53
|
class HttpRequest {
|
|
50
54
|
instance;
|
|
51
55
|
constructor(options) {
|
package/package.json
CHANGED
package/types/http-request.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse } from "axios"
|
|
1
|
+
import { AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse, AxiosRequestHeaders } from "axios"
|
|
2
2
|
import { CookieJar } from "tough-cookie"
|
|
3
3
|
|
|
4
4
|
export interface HttpLiuGuanProxy {
|
|
@@ -16,6 +16,14 @@ export interface HttpServiceTypes {
|
|
|
16
16
|
SEKIRO: 2
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export interface ExtendInternalAxiosRequestConfig extends HttpRequestConfig, InternalAxiosRequestConfig {
|
|
20
|
+
headers: AxiosRequestHeaders;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ExtendAxiosResponse extends AxiosResponse {
|
|
24
|
+
config: ExtendInternalAxiosRequestConfig
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
export interface ExtendAxiosRequestConfig extends Record<string, any> {
|
|
20
28
|
form?: any
|
|
21
29
|
body?: any
|
|
@@ -26,9 +34,9 @@ export interface ExtendAxiosRequestConfig extends Record<string, any> {
|
|
|
26
34
|
useProxy?: boolean | HttpLiuGuanProxy | HttpPhone4GProxy
|
|
27
35
|
jar?: CookieJar
|
|
28
36
|
interceptorHooks?: {
|
|
29
|
-
requestInterceptor?: (config:
|
|
37
|
+
requestInterceptor?: (config: ExtendInternalAxiosRequestConfig) => ExtendInternalAxiosRequestConfig | Promise<ExtendInternalAxiosRequestConfig>
|
|
30
38
|
requestInterceptorCatch?: (error: any) => any
|
|
31
|
-
respondInterceptor?: (response:
|
|
39
|
+
respondInterceptor?: (response: ExtendAxiosResponse) => ExtendAxiosResponse | Promise<ExtendAxiosResponse | any>
|
|
32
40
|
respondInterceptorCatch?: (error: any) => any
|
|
33
41
|
}
|
|
34
42
|
}
|