refactor: make /v1/health accept GET requests (#527)

r0.3
Meng Zhang 2023-10-09 11:34:56 -07:00 committed by GitHub
parent 3eb5f4132c
commit 24eadf0de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -92,7 +92,7 @@ impl Version {
}
#[utoipa::path(
post,
get,
path = "/v1/health",
tag = "v1",
responses(

View File

@ -201,11 +201,17 @@ fn api_router(args: &ServeArgs) -> Router {
None
};
let health_state = Arc::new(health::HealthState::new(args));
let router = Router::new()
.route("/v1/events", routing::post(events::log_event))
/* Remove POST /v1/health route in next major version release. */
.route(
"/v1/health",
routing::post(health::health).with_state(Arc::new(health::HealthState::new(args))),
routing::post(health::health).with_state(health_state.clone()),
)
.route(
"/v1/health",
routing::get(health::health).with_state(health_state),
)
.route(
"/v1/completions",