@ekhein/http-request 1.0.1 → 1.0.3
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 +6 -4
- package/dist/main.js +5 -0
- package/package.json +1 -1
- package/types/http-request.d.ts +13 -5
package/dist/main.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { AxiosInstance
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { HttpRequestConfig } from "../types/http-request";
|
|
2
3
|
export declare class HttpRequest {
|
|
3
4
|
readonly instance: AxiosInstance;
|
|
4
|
-
constructor(options:
|
|
5
|
-
execute<R = any>(options:
|
|
5
|
+
constructor(options: HttpRequestConfig);
|
|
6
|
+
execute<R = any>(options: HttpRequestConfig): Promise<R>;
|
|
6
7
|
post<R = any>(url: string, data?: any): Promise<R>;
|
|
7
8
|
call<R = any>(path: string, data: object): Promise<R>;
|
|
8
9
|
}
|
|
9
|
-
export
|
|
10
|
+
export * from './exceptions';
|
|
11
|
+
export * 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"));
|
|
@@ -214,3 +217,5 @@ class HttpRequest {
|
|
|
214
217
|
}
|
|
215
218
|
}
|
|
216
219
|
exports.HttpRequest = HttpRequest;
|
|
220
|
+
__exportStar(require("./exceptions"), exports);
|
|
221
|
+
__exportStar(require("../types/http-request"), exports);
|
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,14 +34,14 @@ 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
|
}
|
|
35
43
|
|
|
36
|
-
export interface HttpRequestConfig extends AxiosRequestConfig, ExtendAxiosRequestConfig {
|
|
44
|
+
export interface HttpRequestConfig extends AxiosRequestConfig, ExtendAxiosRequestConfig {}
|
|
37
45
|
|
|
38
|
-
}
|
|
46
|
+
export interface HttpResponse extends AxiosResponse, ExtendAxiosResponse {}
|
|
39
47
|
|