Skip to Content
0
Oct 12, 2020 at 01:27 PM

Accessing Request Headers in CDS for Node.js

694 Views

Hi CAP Community,

it looks like access to the Request Headers in Custom Event Handlers does not work as documented. Accessing the Headers via req.headers as documented in the Core Services API returns undefined. I have to fall back to the Express Headers accessible via req._.req.headers.

I have setup an example project to demonstrate the issue.

I guess this is a bug?

Kind regards,

Sebastian

Your environment (run the following commands):

  • cds -v
@sap/cds: 4.1.9
@sap/cds-compiler: 1.39.0
@sap/cds-dk: 3.0.0
@sap/cds-foss: 2.0.0
@sap/cds-reflect: 2.13.0
@sap/cds-runtime: 2.3.1
Node.js: v12.16.1
home: /*** removed ***
request-headers: 1.0.0
undefined: -- missing --
  • node -v
v12.16.1