Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
### Added
- Added type export for types from cds-dk. These types are only available if `@sap/cds-dk` is also present in the project.
- Optional parameter 'options' in `req.reply`. The object can contain, for example, mimetype and/or filename.
- Added types for `req.req` and `req.res` in `cds.Request`
### Changed
- [breaking] Bump dependency to `@sap/cds` to `>=9.0.0`. This means starting with this version, `cds-types` is supposed to be used alongside `@sap/cds@9`!
- `req.params` always returns an array of objects
Expand Down
4 changes: 4 additions & 0 deletions apis/events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class Event<T = unknown> extends EventContext {
*/
export class Request<T = any> extends Event<T> {

req: express.Request

res: express.Response

params: Record<string, any>[]

method: string
Expand Down
3 changes: 3 additions & 0 deletions test/typescript/apis/project/cds-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ srv.before('*', Books, req => {
req.query.elements['foo'].type
})
srv.before('*', async req => {
req.req
Comment thread
schwma marked this conversation as resolved.
req.res

req.event
req.data
req.headers
Expand Down