Browse Source
Bugfix/fix TransformDataSourceInRequestInterceptor after upgrade to NestJS 11 (#4741)
* Fix TransformDataSourceInRequestInterceptor for Express 5
release/2.162.0-beta.1
Thomas Kaul
1 month ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
10 additions and
1 deletions
-
apps/api/src/interceptors/transform-data-source-in-request/transform-data-source-in-request.interceptor.ts
|
|
@ -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 |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|