aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin/api_server.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2022-10-18 14:20:44 +0000
committerAlex <alex@adnab.me>2022-10-18 14:20:44 +0000
commit5670599372f6c3c60dcd74279a0741248fc510c3 (patch)
tree2852a5e3cf2a0d1728b7d67e59e1b13aaae92287 /src/api/admin/api_server.rs
parent7bc9fd34b250384d1b80ed28dc6c9e6abcda69ae (diff)
parentf1c96d108c29ae4ef7b1f7ed8f2c06b6a5744909 (diff)
downloadgarage-5670599372f6c3c60dcd74279a0741248fc510c3.tar.gz
garage-5670599372f6c3c60dcd74279a0741248fc510c3.zip
Merge pull request 'Use status code 204 No Content for empty responses' (#403) from tobikris/garage:http-no-content into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/403
Diffstat (limited to 'src/api/admin/api_server.rs')
-rw-r--r--src/api/admin/api_server.rs6
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))?)
}