cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the maxBodyLength used by CAP when calling the backend?

SamueleBarzaghi
Participant

Hi,

Is possibile to set the option maxBodyLength used by CAP when calling the backend?

Thanks

Sam

gregorw
Active Contributor
0 Kudos

In which context is this needed?

Accepted Solutions (0)

Answers (1)

Answers (1)

matsvei_matsiyuk
Explorer

You can import follow-redirects to your service implementation and then set maxBodyLength.

const cds = require("@sap/cds");
const followRedirects = require("follow-redirects");

const ExampleService = cds.service.impl(async function () {
const srv = await cds.connect.to("serviceName");
followRedirects.maxBodyLength = 1 * 1024 * 1024 * 1024; //1 GB
...
})
hash47
Explorer

Hi matveyma ,

Your solution worked for increasing the maxBodyLength for CAP service calls. But I am curious to know how the 'follow-redirects' plugin is increasing the maxBodyLength. How SAP CAP and follow-redirects are connected to each other?

Instead of using the follow-redirects plugin can we increase the maxBodyLength directly in the CAP application?

Kind Regards,

Harshad