mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 16:43:58 -07:00
Updated HttpResponse to support binary content.
This commit is contained in:
parent
56436fea69
commit
80ed203258
6 changed files with 68 additions and 26 deletions
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Net;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
namespace NzbDrone.Common.Http
|
||||
{
|
||||
|
@ -73,22 +74,19 @@ namespace NzbDrone.Common.Http
|
|||
httpWebResponse = (HttpWebResponse)e.Response;
|
||||
}
|
||||
|
||||
string content = null;
|
||||
Byte[] data = null;
|
||||
|
||||
using (var responseStream = httpWebResponse.GetResponseStream())
|
||||
{
|
||||
if (responseStream != null)
|
||||
{
|
||||
using (var reader = new StreamReader(responseStream))
|
||||
{
|
||||
content = reader.ReadToEnd();
|
||||
}
|
||||
data = responseStream.ToBytes();
|
||||
}
|
||||
}
|
||||
|
||||
stopWatch.Stop();
|
||||
|
||||
var response = new HttpResponse(request, new HttpHeader(httpWebResponse.Headers), content, httpWebResponse.StatusCode);
|
||||
var response = new HttpResponse(request, new HttpHeader(httpWebResponse.Headers), data, httpWebResponse.StatusCode);
|
||||
_logger.Trace("{0} ({1:n0} ms)", response, stopWatch.ElapsedMilliseconds);
|
||||
|
||||
if (!RuntimeInfoBase.IsProduction &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue