Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Fixed StreamResponse bug with seek position #589

Merged
merged 1 commit into from Apr 11, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Nancy/Responses/StreamResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ private static Action<Stream> GetResponseBodyDelegate(Func<Stream> sourceDelegat
{
using (var source = sourceDelegate.Invoke())
{
source.CopyTo(stream);
if (source.CanSeek)
{
source.Position = 0;
}

if (source.CanRead)
{
source.CopyTo(stream);
}
}
};
}
Expand Down