diff --git a/src/Middleware/HealthChecks/ref/Microsoft.AspNetCore.Diagnostics.HealthChecks.netcoreapp3.0.cs b/src/Middleware/HealthChecks/ref/Microsoft.AspNetCore.Diagnostics.HealthChecks.netcoreapp3.0.cs index f3bf04f828..7ddfe4645e 100644 --- a/src/Middleware/HealthChecks/ref/Microsoft.AspNetCore.Diagnostics.HealthChecks.netcoreapp3.0.cs +++ b/src/Middleware/HealthChecks/ref/Microsoft.AspNetCore.Diagnostics.HealthChecks.netcoreapp3.0.cs @@ -16,7 +16,6 @@ namespace Microsoft.AspNetCore.Builder { public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapHealthChecks(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder routes, string pattern) { throw null; } public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapHealthChecks(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder routes, string pattern, Microsoft.AspNetCore.Diagnostics.HealthChecks.HealthCheckOptions options) { throw null; } - public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapHealthChecks(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder routes, string pattern, Microsoft.AspNetCore.Diagnostics.HealthChecks.HealthCheckOptions options, string displayName) { throw null; } } } namespace Microsoft.AspNetCore.Diagnostics.HealthChecks diff --git a/src/Middleware/HealthChecks/src/Builder/HealthCheckEndpointRouteBuilderExtensions.cs b/src/Middleware/HealthChecks/src/Builder/HealthCheckEndpointRouteBuilderExtensions.cs index 599362f9c4..4fd2da5ba7 100644 --- a/src/Middleware/HealthChecks/src/Builder/HealthCheckEndpointRouteBuilderExtensions.cs +++ b/src/Middleware/HealthChecks/src/Builder/HealthCheckEndpointRouteBuilderExtensions.cs @@ -2,12 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; -using Microsoft.Extensions.Options; using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Builder { @@ -33,7 +32,7 @@ namespace Microsoft.AspNetCore.Builder throw new ArgumentNullException(nameof(routes)); } - return MapHealthChecksCore(routes, pattern, null, DefaultDisplayName); + return MapHealthChecksCore(routes, pattern, null); } /// @@ -58,42 +57,10 @@ namespace Microsoft.AspNetCore.Builder throw new ArgumentNullException(nameof(options)); } - return MapHealthChecksCore(routes, pattern, options, DefaultDisplayName); + return MapHealthChecksCore(routes, pattern, options); } - /// - /// Adds a health checks endpoint to the with the specified template, options and display name. - /// - /// The to add the health checks endpoint to. - /// The URL pattern of the health checks endpoint. - /// A used to configure the health checks. - /// The display name for the endpoint. - /// A convention routes for the health checks endpoint. - public static IEndpointConventionBuilder MapHealthChecks( - this IEndpointRouteBuilder routes, - string pattern, - HealthCheckOptions options, - string displayName) - { - if (routes == null) - { - throw new ArgumentNullException(nameof(routes)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - if (string.IsNullOrEmpty(displayName)) - { - throw new ArgumentException("A valid non-empty display name must be provided.", nameof(displayName)); - } - - return MapHealthChecksCore(routes, pattern, options, displayName); - } - - private static IEndpointConventionBuilder MapHealthChecksCore(IEndpointRouteBuilder routes, string pattern, HealthCheckOptions options, string displayName) + private static IEndpointConventionBuilder MapHealthChecksCore(IEndpointRouteBuilder routes, string pattern, HealthCheckOptions options) { if (routes.ServiceProvider.GetService(typeof(HealthCheckService)) == null) { @@ -109,7 +76,7 @@ namespace Microsoft.AspNetCore.Builder .UseMiddleware(args) .Build(); - return routes.Map(pattern, displayName, pipeline); + return routes.Map(pattern, pipeline).WithDisplayName(DefaultDisplayName); } } }