Skip to content

Commit

Permalink
Remove obsolete StaticFileResponseContext constructor #27529 (#28893)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher authored Dec 30, 2020
1 parent 8cf5845 commit 43f9b67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/Middleware/StaticFiles/src/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Microsoft.AspNetCore.StaticFiles.Infrastructure.SharedOptionsBase.RequestPath.ge
Microsoft.AspNetCore.StaticFiles.Infrastructure.SharedOptionsBase.RequestPath.set -> void
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware
Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext
Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext.StaticFileResponseContext() -> void
Microsoft.Extensions.DependencyInjection.DirectoryBrowserServiceExtensions
~Microsoft.AspNetCore.Builder.DefaultFilesOptions.DefaultFileNames.get -> System.Collections.Generic.IList<string>
~Microsoft.AspNetCore.Builder.DefaultFilesOptions.DefaultFileNames.set -> void
Expand Down
22 changes: 2 additions & 20 deletions src/Middleware/StaticFiles/src/StaticFileResponseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,15 @@ namespace Microsoft.AspNetCore.StaticFiles
/// </summary>
public class StaticFileResponseContext
{
/// <summary>
/// Constructs the <see cref="StaticFileResponseContext"/>.
/// </summary>
[Obsolete("Use the constructor that passes in the HttpContext and IFileInfo parameters: StaticFileResponseContext(HttpContext context, IFileInfo file)", false)]
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public StaticFileResponseContext()
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
{
}

/// <summary>
/// Constructs the <see cref="StaticFileResponseContext"/>.
/// </summary>
/// <param name="context">The request and response information.</param>
/// <param name="file">The file to be served.</param>
public StaticFileResponseContext(HttpContext context, IFileInfo file)
{
if (file == null)
{
throw new ArgumentNullException(nameof(file));
}
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
Context = context;
File = file;
Context = context ?? throw new ArgumentNullException(nameof(context));
File = file ?? throw new ArgumentNullException(nameof(file));
}

/// <summary>
Expand Down

0 comments on commit 43f9b67

Please sign in to comment.