Which components to use for JS file download?

Hi,

As I understand, the main issue that you can’t specify content type for received file?

these are several ways how to specify content type.

  • use GetDispatchInfo. here you can set aTransport.ContentType for specific method:
if aMessage.MessageName = 'GetReport' then 
  (aTransport as IROHTTPTransport).ContentType := id_ContentType_application_pdf;
aResponse.ContentType := id_ContentType_application_pdf;
RegisterContentTypeForExtension('.pdf', id_ContentType_application_pdf);
  [ROServiceMethod]
  [ROCustom('HttpApiPath', 'test')]
  function TestMethod(): Binary;
...
function TMyService.TestMethod(): Binary;
begin
  Result := TROHttpApiResult.Create(HTTP_200_code, id_ContentType_application_pdf,'report.pdf',false);
  Result.LoadFromFile('report.pdf');
end;