Skip to content

Commit

Permalink
fix build issue with embed-static feature
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-re-ka committed Feb 7, 2024
1 parent 76537de commit 718add6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ pub async fn get_metrics() -> (StatusCode, String) {

#[cfg(feature = "embed-static")]
async fn static_path(axum::extract::Path(path): axum::extract::Path<String>) -> impl IntoResponse {
use axum::body::Empty;
use axum::body::Full;
use axum::http::header;
use axum::http::header::HeaderValue;

Expand All @@ -390,15 +388,15 @@ async fn static_path(axum::extract::Path(path): axum::extract::Path<String>) ->
match STATIC_DIR.get_file(path) {
None => Response::builder()
.status(StatusCode::NOT_FOUND)
.body(axum::body::boxed(Empty::new()))
.body(Body::empty())
.unwrap(),
Some(file) => Response::builder()
.status(StatusCode::OK)
.header(
header::CONTENT_TYPE,
HeaderValue::from_str(mime_type.as_ref()).unwrap(),
)
.body(axum::body::boxed(Full::from(file.contents())))
.body(Body::from(file.contents()))
.unwrap(),
}
}
Expand Down

0 comments on commit 718add6

Please sign in to comment.