Skip to content

Commit

Permalink
feat(data-source): http数据源参数裁剪与响应裁剪支持异步函数配置
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Sep 19, 2024
1 parent 3391a7b commit 8b646e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/data-source/src/data-sources/Http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class HttpDataSource extends DataSource<HttpDataSourceSchema> {
}

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不会为空,至少是默认值,不会发起请求
Expand All @@ -148,7 +148,7 @@ export default class HttpDataSource extends DataSource<HttpDataSourceSchema> {
}

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) {
Expand Down

0 comments on commit 8b646e5

Please sign in to comment.