flat3 / lodata

The OData v4.01 Producer for Laravel
https://lodata.io/
MIT License
80 stars 27 forks source link

Content-ID MIME header missing for the change set response #808

Closed mgerzabek closed 7 months ago

mgerzabek commented 7 months ago

Hi @27pchrisl,

Currently I'm fiddling around to implement a table editor.

OpenUi5 is nicely requesting the whole changeset in a $batch request as specified in the Multipart Batch Request Body specification.

--batch_id-1712919117215-53
Content-Type: multipart/mixed;boundary=changeset_id-1712919117215-54

--changeset_id-1712919117215-54
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:0.0

PATCH Postings(182) HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:de-DE
Authorization:Bearer ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true

{"comment_settled":"Ausstattungsliste besprochen."}
--changeset_id-1712919117215-54
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:1.0

PATCH Postings(210) HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:de-DE
Authorization:Bearer ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true

{"comment_settled":"AV fertig schreiben."}
--changeset_id-1712919117215-54
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:2.0

PATCH Postings(259) HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:de-DE
Authorization:Bearer ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true

{"hours_settled":3}
--changeset_id-1712919117215-54
Content-Type:application/http
Content-Transfer-Encoding:binary
Content-ID:3.0

PATCH Postings(413) HTTP/1.1
Accept:application/json;odata.metadata=minimal;IEEE754Compatible=true
Accept-Language:de-DE
Authorization:Bearer ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Content-Type:application/json;charset=UTF-8;IEEE754Compatible=true

{"hours_settled":4}
--changeset_id-1712919117215-54--
--batch_id-1712919117215-53--
Group ID (API): postingGroupId

When receiving the response, I get the error $batch failed - Error: Content-ID MIME header missing for the change set response.

I assume this is because the response from Lodata, which looks like

--b6cfd00a-0bc9-4022-b278-45c81a3e55ff
content-type: multipart/mixed;boundary=45bc5161-10d1-4e45-ab29-3d94895a0b11

--45bc5161-10d1-4e45-ab29-3d94895a0b11
content-type: application/http

HTTP/1.0 200 OK
content-type: application/json;metadata=minimal;IEEE754Compatible=true;odata.metadata=minimal
etag: W/"a3cf2ce2a32dd0ce0aeab1b958f8f6284775b64f6f15d3fba69dfc5ea1154d43"

{"@odata.context":"https://timesheet.test/odata/$metadata#Postings/$entity","id":"182",…}
--45bc5161-10d1-4e45-ab29-3d94895a0b11
content-type: application/http

HTTP/1.0 200 OK
content-type: application/json;metadata=minimal;IEEE754Compatible=true;odata.metadata=minimal
etag: W/"24b1c4426bda39ef4f998b67bd7a95ad0d4cbc5e97a9f5eceb4de46e43871689"

{"@odata.context":"https://timesheet.test/odata/$metadata#Postings/$entity","id":"210",…}
--45bc5161-10d1-4e45-ab29-3d94895a0b11
content-type: application/http

HTTP/1.0 200 OK
content-type: application/json;metadata=minimal;IEEE754Compatible=true;odata.metadata=minimal
etag: W/"5cbc5ad16853374a0def9955e3cb2d2016da88e1bde8eb556656c7e33a98874b"

{"@odata.context":"https://timesheet.test/odata/$metadata#Postings/$entity","id":"259",…}
--45bc5161-10d1-4e45-ab29-3d94895a0b11
content-type: application/http

HTTP/1.0 200 OK
content-type: application/json;metadata=minimal;IEEE754Compatible=true;odata.metadata=minimal
etag: W/"d3a034b89bc7633b70b9b4716fe55724e3975753e4ac575f210f0b73598ef8a3"

{"@odata.context":"https://timesheet.test/odata/$metadata#Postings/$entity","id":"413",…}
--45bc5161-10d1-4e45-ab29-3d94895a0b11--

--b6cfd00a-0bc9-4022-b278-45c81a3e55ff--

doesn't contain the Content-ID Header for the individual Entities as specified in the Multipart Batch Response specification.

For brevity I shortened the individual @odata.context json responses, which are fine BTW.

Is there a way to tell Lodata to also add those headers?

27pchrisl commented 7 months ago

Thanks for finding this issue @mgerzabek, fixed in https://github.com/flat3/lodata/releases/tag/v5.33.4.