diff options
author | Tobias Krischer <tobias.krischer@elyxon.de> | 2022-10-16 19:46:15 +0200 |
---|---|---|
committer | Tobias Krischer <tobias.krischer@elyxon.de> | 2022-10-17 10:55:26 +0200 |
commit | 786500332341c8e39f7e3e82e493e567ecaa70e4 (patch) | |
tree | 805e6ca8d90d177410d1610f9086bab7194f8e6e /src/api/admin/api_server.rs | |
parent | 4582a8f34aba85ff7b0a56935f27cc166819dec1 (diff) | |
download | garage-786500332341c8e39f7e3e82e493e567ecaa70e4.tar.gz garage-786500332341c8e39f7e3e82e493e567ecaa70e4.zip |
Use status code 204 No Content for empty responses
Diffstat (limited to 'src/api/admin/api_server.rs')
-rw-r--r-- | src/api/admin/api_server.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/api/admin/api_server.rs b/src/api/admin/api_server.rs index 0816bda1..2896d058 100644 --- a/src/api/admin/api_server.rs +++ b/src/api/admin/api_server.rs @@ -5,7 +5,7 @@ use async_trait::async_trait; use futures::future::Future; use http::header::{ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ALLOW}; -use hyper::{Body, Request, Response}; +use hyper::{Body, Request, Response, StatusCode}; use opentelemetry::trace::SpanRef; @@ -69,7 +69,7 @@ impl AdminApiServer { fn handle_options(&self, _req: &Request<Body>) -> Result<Response<Body>, Error> { Ok(Response::builder() - .status(204) + .status(StatusCode::NO_CONTENT) .header(ALLOW, "OPTIONS, GET, POST") .header(ACCESS_CONTROL_ALLOW_METHODS, "OPTIONS, GET, POST") .header(ACCESS_CONTROL_ALLOW_ORIGIN, "*") @@ -94,7 +94,7 @@ impl AdminApiServer { .ok_or_internal_error("Could not serialize metrics")?; Ok(Response::builder() - .status(200) + .status(StatusCode::OK) .header(http::header::CONTENT_TYPE, encoder.format_type()) .body(Body::from(buffer))?) } |