cancel
Showing results for 
Search instead for 
Did you mean: 

CAP - srv.send with headers

nicorunge
Participant
0 Kudos

Hi CAP Experts,

following the docs here, it should be possible to provide a header parameter using srv.send:

 

await srv.send({ query: SELECT.from('Books'), headers: { some: 'header' } })

 

In my tests, I was not able to receive this provided header parameter in my Books handler. I'm accessing the headers this way: req.http.req.headers

I've created a little demo project to reproduce this behavior: https://github.com/nocin/cap_send_headers
Find my test queries in test/header.http

Do I misunderstand the docs or can someone give a hint, what I'm doing wrong?

Thanks!
Nico

 

View Entire Topic
nicorunge
Participant
0 Kudos

As always, reading carefully helps. The headers are transferred to the CAP request object and not to the expressJS request object.

The passed header is therefore in req.headers and not in req.http.req.headers.