Use TaskCache class from Microsoft.Extensions.TaskCache.Sources instead of Task.FromResult(0) (#99)
This commit is contained in:
parent
7e4c9aaebc
commit
2807e0b436
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
||||
namespace Microsoft.AspNetCore.Buffering
|
||||
{
|
||||
|
|
@ -133,7 +134,7 @@ namespace Microsoft.AspNetCore.Buffering
|
|||
{
|
||||
return FlushAsync(cancellationToken);
|
||||
}
|
||||
return Task.FromResult(0);
|
||||
return TaskCache.CompletedTask;
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,11 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Http.Abstractions": "1.1.0-*"
|
||||
"Microsoft.AspNetCore.Http.Abstractions": "1.1.0-*",
|
||||
"Microsoft.Extensions.TaskCache.Sources": {
|
||||
"version": "1.1.0-*",
|
||||
"type": "build"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Rewrite.Logging;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Internal;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
|
|
@ -17,8 +18,6 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
/// </summary>
|
||||
public class RewriteMiddleware
|
||||
{
|
||||
private static readonly Task CompletedTask = Task.FromResult(0);
|
||||
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly RewriteOptions _options;
|
||||
private readonly IFileProvider _fileProvider;
|
||||
|
|
@ -85,7 +84,7 @@ namespace Microsoft.AspNetCore.Rewrite
|
|||
_logger.RewriteMiddlewareRequestResponseComplete(
|
||||
context.Response.Headers[HeaderNames.Location],
|
||||
context.Response.StatusCode);
|
||||
return CompletedTask;
|
||||
return TaskCache.CompletedTask;
|
||||
case RuleTermination.StopRules:
|
||||
_logger.RewriteMiddlewareRequestStopRules();
|
||||
return _next(context);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,11 @@
|
|||
"Microsoft.Extensions.Configuration.Abstractions": "1.1.0-*",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "1.1.0-*",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "1.1.0-*",
|
||||
"Microsoft.Extensions.Options": "1.1.0-*"
|
||||
"Microsoft.Extensions.Options": "1.1.0-*",
|
||||
"Microsoft.Extensions.TaskCache.Sources": {
|
||||
"version": "1.1.0-*",
|
||||
"type": "build"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue