mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Proxy Nzb/Torrent Downloads thru Prowlarr
This commit is contained in:
29
src/Prowlarr.Http/Extensions/ResponseExtensions.cs
Normal file
29
src/Prowlarr.Http/Extensions/ResponseExtensions.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.IO;
|
||||
using Nancy;
|
||||
|
||||
namespace NzbDrone.Http.Extensions
|
||||
{
|
||||
public static class ResponseExtensions
|
||||
{
|
||||
public static Response FromByteArray(this IResponseFormatter formatter, byte[] body, string contentType = null)
|
||||
{
|
||||
return new ByteArrayResponse(body, contentType);
|
||||
}
|
||||
}
|
||||
|
||||
public class ByteArrayResponse : Response
|
||||
{
|
||||
public ByteArrayResponse(byte[] body, string contentType = null)
|
||||
{
|
||||
this.ContentType = contentType ?? "application/octet-stream";
|
||||
|
||||
this.Contents = stream =>
|
||||
{
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
{
|
||||
writer.Write(body);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user