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.
@@ -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, key: string, type?: RespType): Promise<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, key_1) {
109
- return __awaiter(this, arguments, void 0, function* (sessionInfo, key, type = RespType.TEXT) {
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: key, payload: JSON.stringify(sessionInfo) };
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: exports.HttpHeaders };
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dff-util",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {