Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 2504

DataSnap web service doesn't return TMemoryStream correctly with Delphi 10.1 and 10.2

$
0
0

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?

Source code


Viewing all articles
Browse latest Browse all 2504

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>