Use the new HttpContext.Features API.

This commit is contained in:
Chris R 2015-08-31 09:26:50 -07:00
parent a60188e10b
commit 916cb32e7e
2 changed files with 4 additions and 4 deletions

View File

@ -38,9 +38,9 @@ namespace Microsoft.AspNet.StaticFiles
public Task Invoke(HttpContext context)
{
// Check if there is a SendFile feature already present
if (context.GetFeature<IHttpSendFileFeature>() == null)
if (context.Features.Get<IHttpSendFileFeature>() == null)
{
context.SetFeature<IHttpSendFileFeature>(new SendFileWrapper(context.Response.Body, _logger));
context.Features.Set<IHttpSendFileFeature>(new SendFileWrapper(context.Response.Body, _logger));
}
return _next(context);

View File

@ -324,7 +324,7 @@ namespace Microsoft.AspNet.StaticFiles
ApplyResponseHeaders(Constants.Status200Ok);
string physicalPath = _fileInfo.PhysicalPath;
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
var sendFile = _context.Features.Get<IHttpSendFileFeature>();
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
{
await sendFile.SendFileAsync(physicalPath, 0, _length, _context.RequestAborted);
@ -371,7 +371,7 @@ namespace Microsoft.AspNet.StaticFiles
ApplyResponseHeaders(Constants.Status206PartialContent);
string physicalPath = _fileInfo.PhysicalPath;
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
var sendFile = _context.Features.Get<IHttpSendFileFeature>();
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
{
if (_logger.IsEnabled(LogLevel.Verbose))