优化格式

pull/12/head
Changeden 4 years ago
parent 3ceb8cdc93
commit 4eae92b033
  1. 10
      sop-sdk/sdk-nodejs/common/OpenClient.js

@ -79,7 +79,7 @@ const executeRequest = async (instance = {}, request, token, callback, customOpt
case RequestType.POST_FILE: { case RequestType.POST_FILE: {
let formData; let formData;
if (IS_RUN_IN_BROWSER) { if (IS_RUN_IN_BROWSER) {
formData = new window.FormData() formData = new window.FormData();
(request.files || []).forEach(({name, path}) => { (request.files || []).forEach(({name, path}) => {
formData.append(name, path, { formData.append(name, path, {
contentType: 'application/octet-stream' contentType: 'application/octet-stream'
@ -167,8 +167,8 @@ module.exports = class OpenClient {
* @param options 自定义参数如headers * @param options 自定义参数如headers
* */ * */
executeSync(request, options) { executeSync(request, options) {
return new Promise((resolve) => { return new Promise(async (resolve) => {
const _ = this.execute(request, res => { await this.execute(request, res => {
resolve(res); resolve(res);
}, options); }, options);
}); });
@ -203,8 +203,8 @@ module.exports = class OpenClient {
* @param options 自定义参数如headers * @param options 自定义参数如headers
*/ */
executeTokenSync(request, token, options) { executeTokenSync(request, token, options) {
return new Promise((resolve) => { return new Promise(async (resolve) => {
const _ = this.executeToken(request, token, res => { await this.executeToken(request, token, res => {
resolve(res); resolve(res);
}, options); }, options);
}); });

Loading…
Cancel
Save