mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
优化格式
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user