Make encoders registration optional (#140)
This commit is contained in:
parent
e28e1df605
commit
c310c27ab8
|
|
@ -24,6 +24,17 @@ namespace Microsoft.AspNetCore.StaticFiles
|
|||
private readonly IDirectoryFormatter _formatter;
|
||||
private readonly IFileProvider _fileProvider;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the SendFileMiddleware. Using <see cref="HtmlEncoder.Default"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="next">The next middleware in the pipeline.</param>
|
||||
/// <param name="hostingEnv">The <see cref="IHostingEnvironment"/> used by this middleware.</param>
|
||||
/// <param name="options">The configuration for this middleware.</param>
|
||||
public DirectoryBrowserMiddleware(RequestDelegate next, IHostingEnvironment hostingEnv, IOptions<DirectoryBrowserOptions> options)
|
||||
: this(next, hostingEnv, HtmlEncoder.Default, options)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the SendFileMiddleware.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,14 @@ namespace Microsoft.AspNetCore.StaticFiles
|
|||
{
|
||||
public class DirectoryBrowserMiddlewareTests
|
||||
{
|
||||
[Fact]
|
||||
public void WorksWithoutEncoderRegistered()
|
||||
{
|
||||
// No exception, uses HtmlEncoder.Default
|
||||
StaticFilesTestServer.Create(
|
||||
app => app.UseDirectoryBrowser());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task NullArguments()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue