Batch request fails with CAP
See original GitHub issueDescribe the bug
I am using the “SDK’s Generator for JavaScript” to generate OData client for a service generated by using CAP (following this blog post).
After I change the default service path from VALUE_IS_UNDEFINED
to my service path (/sitn-admin-srv
) I could use all the operations without any problem.
However, when I use the batch request (following this blog post), the request has reached to the server fine, but I got warnings in the server side;
[2020-10-19T13:35:50.287Z | WARNING | 1854218]: 'sitn' is not an entity set, a singleton, an action import, or a function import
where my service path is sitn-admin-srv
.
When I set the _defaultServicePath
to empty string in the entity level (file is SituationTemplateMetaData.ts
), then batch request works fine, but of course all the single operations are being made to the root level and I get 404 errors for the single operations.
Maybe the batch request concatenates the default service path twice? Or am I doing something wrong?
To Reproduce Steps to reproduce the behavior:
- Get any OData service (like bookshop app)
- Generate client library using the generator
- Change the default paths in generated files
export const defaultSitnAdminSrvServicePath = '/<serice-path>';
inBatchRequest.ts
andstatic _defaultServicePath = '/<service-path>';
in<entity>.ts
- Single requests will work, but batch request will get a warning like above.
- Leave the service path empty in the entity file, batch request will work but the single requests will get 404.
I can also provide you my code, or collabrate further if there is a need.
Used Versions:
- node version via
node -v
: v12.16.0 - npm version via
npm -v
: 6.13.7 - SAP Cloud SDK version you used as dependency: `-- @sap-cloud-sdk/core@1.30.0
- Cli: `-- @sap-cloud-sdk/cli@0.1.12
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Hey @meakgoz2,
according to the batch specification endpoints that accept batch should allow to set subrequest paths that are absolute, relative to the service or relative to the entity set. The SDK sets the subrequest path relative to the service by default, but CAP currently only accepts paths relative to the entity set. We provide an additional configuration option that you can use to diverge from this default behaviour.
Try:
I hope that helps, we will add documentation on this soon.
Hey @meakgoz2, we have added this to our documentation here.