Archived
1
0

Don't require auth for healthz (#2055)

* Don't require authentication for healthz endpoint

* Add FAQ entry for /healthz
This commit is contained in:
Asher
2020-09-08 13:59:01 -05:00
committed by GitHub
parent e44e574ce1
commit 0a2328c1f6
2 changed files with 18 additions and 14 deletions

View File

@ -1,6 +1,4 @@
import * as http from "http"
import { HttpCode, HttpError } from "../../common/http"
import { HttpProvider, HttpResponse, Route, Heart, HttpProviderOptions } from "../http"
import { HttpProvider, HttpResponse, Heart, HttpProviderOptions } from "../http"
/**
* Check the heartbeat.
@ -10,15 +8,8 @@ export class HealthHttpProvider extends HttpProvider {
super(options)
}
public async handleRequest(route: Route, request: http.IncomingMessage): Promise<HttpResponse> {
if (!this.authenticated(request)) {
if (this.isRoot(route)) {
return { redirect: "/login", query: { to: route.fullPath } }
}
throw new HttpError("Unauthorized", HttpCode.Unauthorized)
}
const result = {
public async handleRequest(): Promise<HttpResponse> {
return {
cache: false,
mime: "application/json",
content: {
@ -26,7 +17,5 @@ export class HealthHttpProvider extends HttpProvider {
lastHeartbeat: this.heart.lastHeartbeat,
},
}
return result
}
}