cap-js-community / odata-v2-adapter

OData V2 adapter for CDS. Exposes a full-fledged OData V2 service, converting OData V2 requests to CDS OData V4 service calls and responses back.
https://www.npmjs.com/package/@cap-js-community/odata-v2-adapter
Apache License 2.0
23 stars 8 forks source link

Issue with the metadata endpoint #34

Closed zzsshalik closed 7 months ago

zzsshalik commented 7 months ago

I am trying to retrieve metadata v2 via this url

http://localhost:4004/odata/v2/my-app/$metadata

And I retrieve this issue

image

If I just remove this row from the source code of the library then it works

image

propagateHeaders(req) returns these headers for me

{"connection":"keep-alive","cache-control":"max-age=0","sec-ch-ua":"\"Not A(Brand\";v=\"99\", \"Google Chrome\";v=\"121\", \"Chromium\";v=\"121\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"macOS\"","dnt":"1","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7","sec-fetch-site":"same-origin","sec-fetch-mode":"navigate","sec-fetch-user":"?1","sec-fetch-dest":"document","referer":"http://localhost:4004/","accept-encoding":"gzip, deflate, br","accept-language":"en,en-US;q=0.9,ru;q=0.8","x-request-id":"fa4d5254-bb3b-4ea3-bce6-68dd8d7e71da","x-correlation-id":"fa4d5254-bb3b-4ea3-bce6-68dd8d7e71da","x-correlationid":"fa4d5254-bb3b-4ea3-bce6-68dd8d7e71da"}

I am using "@sap/cds": "7.5.1"

oklemenz2 commented 7 months ago

I will provide a fix. Can you confirm, that when you just delete "connection" from headers, that it also would work? I'd like to keep a exclude list...

zzsshalik commented 7 months ago

Yes, it works without connection header

image
oklemenz2 commented 7 months ago

Great, you have the fix in a minute...

zzsshalik commented 7 months ago

Yes, it was too fast. Thank you. I hope fix will be included in next version of the Library

oklemenz2 commented 7 months ago

Here we go. New release is there: https://github.com/cap-js-community/odata-v2-adapter/releases/tag/v1.12.4 Can you check?

zzsshalik commented 7 months ago

It will take some time. I will let you know later

zzsshalik commented 7 months ago

Yes, it works now. But I have one more problem. It looks that it would be better to create a different issue for that