When I create a DataSnap web service with Delphi 10 Seattle it displays the PDF stream in the browser correctly.
function TServerMethods2.GetDocument: TMemoryStream; begin Result := TMemoryStream.Create; Result.LoadFromFile('Test.pdf'); end;
procedure TWebModule3.WebModuleAfterDispatch(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); begin Response.ContentType := 'application/pdf'; Response.SetCustomHeader('X-Content-Type-Options', 'nosniff'); end;
If I compile the same project with Delphi 10.1 or 10.2 it doesn't work. The browser gives me an error while displaying the document and a download does also not work.
Has there something changed with Delphi 10.1 or Delphi 10.2 or is there a bug?