mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
feat(data-source): http数据源参数裁剪与响应裁剪支持异步函数配置
This commit is contained in:
parent
f6885a06b6
commit
5267b4bb93
@ -137,7 +137,7 @@ export default class HttpDataSource extends DataSource<HttpDataSourceSchema> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof this.schema.beforeRequest === 'function') {
|
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不会为空,至少是默认值,不会发起请求
|
// 注意:在编辑器中mockData不会为空,至少是默认值,不会发起请求
|
||||||
@ -148,7 +148,7 @@ export default class HttpDataSource extends DataSource<HttpDataSourceSchema> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof this.schema.afterResponse === 'function') {
|
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) {
|
if (this.schema.responseOptions?.dataPath) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user