cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Serving Media Data: Content Type application/json dets data in @Core.IsMediaType field to null

gregorw
SAP Mentor
SAP Mentor
1,344

Hello CAP Community,

it seems that the Media Handling works great for all kind of data formats like Word, Excel, PNG, JPEG, YAML and others. But it doesn't work correctly for JSON. When I create a new entry using the URL http://localhost:4004/$fiori-preview/AdminService/DocumentsWithDraft?sap-language=en#preview-app provided from my sample app bookshop-demo I see the following requests:

As you can see the content is sent with the correct Content Type application/json. But in the following request where the current state of the entity is read the field content@odata.mediaContentType is returned as null:

When a YAML file is uploaded you directly see that the field "Content" is filled. Here you see that the Content-Type is set:

But in contrast to the JSON file also the value for content@odata.mediaContentType is filled:

Looking forward for a correction.

Best Regards
Gregor

Accepted Solutions (0)

Answers (1)

Answers (1)

vitaly_kozyura
Advisor
Advisor
0 Likes

@gregorw  We added support of streaming with 'application/json' as content-type. The data field should be modelled as cds.LargeBinary. The feature to be provided with the next release of @sap/cds.