dff-util 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/http.d.ts +1 -1
- package/dist/main/http.js +5 -4
- package/package.json +1 -1
package/dist/main/http.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class Http {
|
|
|
18
18
|
static Post(url: string, data: any, headers: any, type?: RespType): Promise<any>;
|
|
19
19
|
static Put(url: string, data: any, headers: any, type?: RespType): Promise<any>;
|
|
20
20
|
static Delete(url: string, params: any, headers: any, type?: RespType): Promise<any>;
|
|
21
|
-
static Token(sessionInfo: any,
|
|
21
|
+
static Token(sessionInfo: any, appKey: string, apiKey?: string, type?: RespType): Promise<any>;
|
|
22
22
|
static Upload(fullUrl: string, file: File, data?: Record<string, any>, headers?: any, type?: RespType): Promise<any>;
|
|
23
23
|
static Download(fullUrl: string, params: any, headers?: any): Promise<Buffer>;
|
|
24
24
|
}
|
package/dist/main/http.js
CHANGED
|
@@ -105,13 +105,14 @@ class Http {
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
static Token(sessionInfo_1,
|
|
109
|
-
return __awaiter(this, arguments, void 0, function* (sessionInfo,
|
|
108
|
+
static Token(sessionInfo_1, appKey_1, apiKey_1) {
|
|
109
|
+
return __awaiter(this, arguments, void 0, function* (sessionInfo, appKey, apiKey, type = RespType.TEXT) {
|
|
110
110
|
const url = `${Http.API_BASE_URL}${Http.TOKEN_URL}`;
|
|
111
|
-
const params = { key:
|
|
111
|
+
const params = { key: appKey, payload: JSON.stringify(sessionInfo) };
|
|
112
112
|
const fullUrl = `${url}?${new URLSearchParams(params).toString()}`;
|
|
113
|
+
const headers = Object.assign(Object.assign({}, Headers), { 'X-API-KEY': apiKey || '' });
|
|
113
114
|
try {
|
|
114
|
-
const requestOptions = { method: 'GET', headers:
|
|
115
|
+
const requestOptions = { method: 'GET', headers: headers };
|
|
115
116
|
const response = yield fetch(fullUrl, requestOptions);
|
|
116
117
|
return yield Http.RespData(response, type);
|
|
117
118
|
}
|