feat(data-sources): http数据裁剪函数content参数添加options

This commit is contained in:
roymondchen 2023-11-21 19:14:45 +08:00
parent 979d6e2e31
commit 5549e8cff9
2 changed files with 4 additions and 2 deletions

View File

@ -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 });
res = this.schema.afterResponse(res, { app: this.app, dataSource: this, options: reqOptions });
}
if (this.schema.responseOptions?.dataPath) {

View File

@ -21,7 +21,9 @@ export interface HttpDataSourceSchema extends DataSourceSchema {
beforeRequest:
| string
| ((options: HttpOptions, content: { app: AppCore; dataSource: HttpDataSource }) => HttpOptions);
afterResponse: string | ((response: any, content: { app: AppCore; dataSource: HttpDataSource }) => any);
afterResponse:
| string
| ((response: any, content: { app: AppCore; dataSource: HttpDataSource; options: Partial<HttpOptions> }) => any);
}
export interface DataSourceManagerOptions {