Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

Commit 916cb32

Browse files
committed
Use the new HttpContext.Features API.
1 parent a60188e commit 916cb32

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Microsoft.AspNet.StaticFiles/SendFileMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public SendFileMiddleware([NotNull] RequestDelegate next, [NotNull] ILoggerFacto
3838
public Task Invoke(HttpContext context)
3939
{
4040
// Check if there is a SendFile feature already present
41-
if (context.GetFeature<IHttpSendFileFeature>() == null)
41+
if (context.Features.Get<IHttpSendFileFeature>() == null)
4242
{
43-
context.SetFeature<IHttpSendFileFeature>(new SendFileWrapper(context.Response.Body, _logger));
43+
context.Features.Set<IHttpSendFileFeature>(new SendFileWrapper(context.Response.Body, _logger));
4444
}
4545

4646
return _next(context);

src/Microsoft.AspNet.StaticFiles/StaticFileContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public async Task SendAsync()
324324
ApplyResponseHeaders(Constants.Status200Ok);
325325

326326
string physicalPath = _fileInfo.PhysicalPath;
327-
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
327+
var sendFile = _context.Features.Get<IHttpSendFileFeature>();
328328
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
329329
{
330330
await sendFile.SendFileAsync(physicalPath, 0, _length, _context.RequestAborted);
@@ -371,7 +371,7 @@ internal async Task SendRangeAsync()
371371
ApplyResponseHeaders(Constants.Status206PartialContent);
372372

373373
string physicalPath = _fileInfo.PhysicalPath;
374-
var sendFile = _context.GetFeature<IHttpSendFileFeature>();
374+
var sendFile = _context.Features.Get<IHttpSendFileFeature>();
375375
if (sendFile != null && !string.IsNullOrEmpty(physicalPath))
376376
{
377377
if (_logger.IsEnabled(LogLevel.Verbose))

0 commit comments

Comments
 (0)