I'm trying to define the content-type of a REST response.
I followed the guide at https://www.outsystems.com/forums/discussion/19342/rest-output-mime-type/ but without success. I always get it as "plain/text".
Also, is there a way to define the content-type per resource instead on the "onResponse" callback? For specific reasons I need the content-type to be different per resource.
update: If I add a header like "content-typeaaa" to "application/json" it is delivered to the client. It seems that the server is always overriding the "content-type" I'm setting.
Thanks
I just went thru the REST service and noticed that I was adding the header as "Content-type" (lower-case t). As soon as fixed name to "Content-Type" it started to work...
Hi Miguel,
What version of the platform and stack (.Net or JAVA) are you using? So I can test it out and see if there is an issue with it.
But yes, you are supposed to be able to set the header at any point in your service, not only in the OnResponse callback. So if you set inside a specific action it will only affect that one action.
Also regarding "application/json", if your output parameter is a structure or list it will automatically default to type "application/json" instead of plain text. Why do you need to go on the custom way for that one?
Regards,João Rosado
Hi João,
I didn't notice I got a reply, sorry for coming here so late!
So, regarding your questions:
I'm using a personal space with the latest version of the Service Studio. I'm not sure if this is enough information for the case...