mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 22:38:30 +01:00
Replace custom code with Asp.Net Core code
This commit is contained in:
@@ -10,8 +10,6 @@ namespace Emby.Server.Implementations.Services
|
||||
public class HttpResult
|
||||
: IHttpResult, IAsyncStreamWriter
|
||||
{
|
||||
public object Response { get; set; }
|
||||
|
||||
public HttpResult(object response, string contentType, HttpStatusCode statusCode)
|
||||
{
|
||||
this.Headers = new Dictionary<string, string>();
|
||||
@@ -21,6 +19,8 @@ namespace Emby.Server.Implementations.Services
|
||||
this.StatusCode = statusCode;
|
||||
}
|
||||
|
||||
public object Response { get; set; }
|
||||
|
||||
public string ContentType { get; set; }
|
||||
|
||||
public IDictionary<string, string> Headers { get; private set; }
|
||||
@@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.Services
|
||||
|
||||
public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = RequestContext == null ? null : RequestContext.Response;
|
||||
var response = RequestContext?.Response;
|
||||
|
||||
if (this.Response is byte[] bytesResponse)
|
||||
{
|
||||
@@ -45,13 +45,14 @@ namespace Emby.Server.Implementations.Services
|
||||
|
||||
if (response != null)
|
||||
{
|
||||
response.OriginalResponse.ContentLength = contentLength;
|
||||
response.ContentLength = contentLength;
|
||||
}
|
||||
|
||||
if (contentLength > 0)
|
||||
{
|
||||
await responseStream.WriteAsync(bytesResponse, 0, contentLength, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user