You are not logged in.
Hi,
I need to add not only a HEADER_CONTENT_TYPE header, but also a:
Content-Disposition: attachment; filename=<a server side suggested file name>
but seems that only the last header added to the property TServiceCustomAnswer.Header is sent back to the client
The OnAfterURI event can't be used because it does not know the suggested file name. (it is determined inside the interface based service).
Same as for overriding the URI method of the TSQLRestServer.
I'm NOT using the last version of the framework (don't ask! ) maybe is something already solved in latest versions?
If not, any suggestion on how to do it ?
Thanks!
Offline
but seems that only the last header added to the property TServiceCustomAnswer.Header is sent back to the client
You can add multiple headers to TServiceCustomAnswer.Header, but Content-Type must be first header.
Result.Header := 'Content-Type: application/pdf'
+ #13#10 + 'Content-Disposition: inline; filename="report.pdf"';
P.S.
You can debug TSQLHttpServer.Request to find what's wrong with your headers.
Last edited by Chaa (2017-03-15 12:03:36)
Offline
Thanks for the answer Chaa,
it is exactly what I have tried, but it seemed that the first header specified ( Content-Type ) is 'lost' and does not reach the client
Now I had tried swapping the 2 headers ( Content-Disposition first, then Content-Type ) and it seems work!
a little bit odd, but maybe I'm just ignoring something.
Thanks again!
Offline