Bugfix/fix TransformDataSourceInRequestInterceptor after upgrade to NestJS 11 (#4741)
* Fix TransformDataSourceInRequestInterceptor for Express 5
This commit is contained in:
parent
a1786c95a1
commit
a8a31c141d
@ -43,7 +43,16 @@ export class TransformDataSourceInRequestInterceptor<T>
|
||||
const dataSourceValue = request[type]?.dataSource;
|
||||
|
||||
if (dataSourceValue && !DataSource[dataSourceValue]) {
|
||||
request[type].dataSource = decodeDataSource(dataSourceValue);
|
||||
// In Express 5, request.query is read-only, so request[type].dataSource cannot be directly modified
|
||||
Object.defineProperty(request, type, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: {
|
||||
...request[type],
|
||||
dataSource: decodeDataSource(dataSourceValue)
|
||||
},
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user