refactor: 更改健康检查返回码

This commit is contained in:
Argo Zhang 2019-08-13 17:30:56 +08:00
parent 35b291fa06
commit 1e8ef647f7
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.Builder
@ -24,6 +25,12 @@ namespace Microsoft.AspNetCore.Builder
{
context.Response.ContentType = "application/json";
return context.Response.WriteAsync(JsonConvert.SerializeObject(report));
},
ResultStatusCodes =
{
[HealthStatus.Healthy] = StatusCodes.Status200OK,
[HealthStatus.Degraded] = StatusCodes.Status200OK,
[HealthStatus.Unhealthy] = StatusCodes.Status200OK
}
});
return app;