Skip to content

Commit

Permalink
Merge pull request #14 from mateusvicente100/master
Browse files Browse the repository at this point in the history
Set stream position to zero
  • Loading branch information
viniciussanchez authored Aug 23, 2022
2 parents 4503ff4 + 38c4e07 commit 82cbea4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Horse.OctetStream.pas
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ procedure OctetStream(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINE

if Assigned(LContent) and LContent.InheritsFrom(TStream) then
begin
TStream(LContent).Position := 0;

if Trim(Res.RawWebResponse.ContentType).IsEmpty then
Res.ContentType(CONTENT_TYPE);

Expand All @@ -101,6 +103,8 @@ procedure OctetStream(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINE

if Assigned(LContent) and LContent.InheritsFrom(TFileReturn) then
begin
TFileReturn(LContent).Stream.Position := 0;

if Trim(Res.RawWebResponse.ContentType).IsEmpty then
Res.ContentType(CONTENT_TYPE);

Expand Down

0 comments on commit 82cbea4

Please sign in to comment.