From 8b646e58678733550dbb093437e6a69ef45a454f Mon Sep 17 00:00:00 2001 From: roymondchen Date: Thu, 19 Sep 2024 20:38:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(data-source):=20http=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E5=8F=82=E6=95=B0=E8=A3=81=E5=89=AA=E4=B8=8E=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E8=A3=81=E5=89=AA=E6=94=AF=E6=8C=81=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/data-source/src/data-sources/Http.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/data-source/src/data-sources/Http.ts b/packages/data-source/src/data-sources/Http.ts index cce05736e..4dbb9b673 100644 --- a/packages/data-source/src/data-sources/Http.ts +++ b/packages/data-source/src/data-sources/Http.ts @@ -137,7 +137,7 @@ export default class HttpDataSource extends DataSource { } if (typeof this.schema.beforeRequest === 'function') { - reqOptions = this.schema.beforeRequest(reqOptions, { app: this.app, dataSource: this }); + reqOptions = await this.schema.beforeRequest(reqOptions, { app: this.app, dataSource: this }); } // 注意:在编辑器中mockData不会为空,至少是默认值,不会发起请求 @@ -148,7 +148,7 @@ export default class HttpDataSource extends DataSource { } if (typeof this.schema.afterResponse === 'function') { - res = this.schema.afterResponse(res, { app: this.app, dataSource: this, options: reqOptions }); + res = await this.schema.afterResponse(res, { app: this.app, dataSource: this, options: reqOptions }); } if (this.schema.responseOptions?.dataPath) {