cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing response headers from remote service calls in CAP

carlonnheim
Participant

Hi,

I have a scenario where I need to access the remote service response headers after having made a call like so

const svc = await cds.connect.to('someservice')

let results = svc.tx(req).send(somequery);
// Here, results contains the parsed response payload, but I cannot find the response headers

What is the appropriate way to do this? I have tried constructing a cds.Request first and then emitting it, but I cannot find the headers anywhere in the request object after the call completes either.

Thanks!

//Carl

View Entire Topic
0 Kudos

Hi,

this is unfortunately not possible right now.

carlonnheim
Participant

Ok, is it planned for the future? It can be worked around either by "patch-package" or using the cloud-sdk in these scenarios for example, but it is inconvenient.

Thanks!

//Carl

tobias_steckenborn
Active Participant
0 Kudos

sambr do you happen to know if there's any update on this? Interacting e.g. with Variant Configuration (https://api.sap.com/api/ProductConfigurationService/overview) you need to fetch some values out of the header of one of the requests to pass into further requests.

0 Kudos

No it's not possible, you can add a custom handler though and do all the communication with the backend service yourself.