I have a XData Service and a 3rdParty client is calling it. It makes POST Requests where the Content-Type is text/plain instead of the usual/proper application/json
Unfortunately I can not change the 3rdParty client.
currently XData raises an error and responds with this:
{
"error": {
"code": "UnsupportedMediaType",
"message": "Unsupported media type: text/plain"
}
my (simplified) Service looks like that:
[ServiceContract]
IMyService = Interface(IInvokable)
['{E41AABF3-789D-4AD7-BC75-6877007E72AF}']
[HttpPOST]
Function Upload(body: TJsonObject): TJsonObject;
end;
a sample curl call would look like that:
curl -X 'POST'
'http://localhost/api/MyService'
-H 'Content-Type: text/plain'
-d '{"type":"sampleJson","level":"WARNING","data":"some data"}'
is there a way I can make XData accept text/plain?
Extra points if I could read the POST payload as a string or stream, as the json might be malformed sometimes.
thanks in advance