diff --git a/crates/frontend/src/routes/timezones.rs b/crates/frontend/src/routes/timezones.rs index b4c75ed..8a3c1f5 100644 --- a/crates/frontend/src/routes/timezones.rs +++ b/crates/frontend/src/routes/timezones.rs @@ -1,4 +1,3 @@ -use axum::response::{IntoResponse, Response}; use headers::{CacheControl, ContentType, HeaderMapExt}; use http::{HeaderMap, HeaderValue, Method}; use itertools::Itertools; @@ -14,7 +13,7 @@ static VTIMEZONES_JSON: LazyLock = LazyLock::new(|| { .unwrap() }); -pub async fn route_timezones(method: Method) -> Response { +pub async fn route_timezones(method: Method) -> (HeaderMap, &'static str) { let mut headers = HeaderMap::new(); headers.typed_insert(ContentType::json()); headers.insert( @@ -24,7 +23,17 @@ pub async fn route_timezones(method: Method) -> Response { headers.typed_insert(CacheControl::new().with_max_age(Duration::from_hours(2))); if method == Method::HEAD { - return headers.into_response(); + return (headers, ""); } - (headers, VTIMEZONES_JSON.as_str()).into_response() + (headers, VTIMEZONES_JSON.as_str()) +} + +#[cfg(test)] +#[tokio::test] +async fn test_vtimezones_json() -> () { + // Since there's an unwrap make sure this doesn't fail + assert!(!VTIMEZONES_JSON.as_str().is_empty()); + + assert!(route_timezones(Method::HEAD).await.1.is_empty()); + assert!(!route_timezones(Method::GET).await.1.is_empty()); }