@tmsfe/tms-core 0.0.212 → 0.0.214
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 +1 -1
- package/src/request.js +15 -0
package/package.json
CHANGED
package/src/request.js
CHANGED
|
@@ -235,6 +235,21 @@ export default class Request {
|
|
|
235
235
|
return `${validHost}/${path}`;
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* 准备请求数据(包含参数组装和签名)
|
|
240
|
+
* @public
|
|
241
|
+
* @memberof Request
|
|
242
|
+
* @param {Object} param 业务参数
|
|
243
|
+
* @returns {Promise<Object>} 处理后的请求数据(包含签名)
|
|
244
|
+
* @example
|
|
245
|
+
* const request = tms.createRequest();
|
|
246
|
+
* const requestData = await request.prepareRequestData({ userId: 123 });
|
|
247
|
+
*/
|
|
248
|
+
async prepareRequestData(param = {}) {
|
|
249
|
+
const requestParam = await composeParam(param, this.withAuth, this.baseParam);
|
|
250
|
+
return sign(requestParam, this.secretKey);
|
|
251
|
+
}
|
|
252
|
+
|
|
238
253
|
/**
|
|
239
254
|
* @public
|
|
240
255
|
* @memberof Request
|