From 60934e593b9f9c9d38fb5c3100e6cf6391fa9b06 Mon Sep 17 00:00:00 2001 From: Sashanoraa Date: Sun, 6 Apr 2025 23:59:44 -0400 Subject: [PATCH] Add the content length header to the qmdl file response --- bin/src/server.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/src/server.rs b/bin/src/server.rs index c9a531a..28108a8 100644 --- a/bin/src/server.rs +++ b/bin/src/server.rs @@ -1,5 +1,5 @@ use axum::body::Body; -use axum::http::header::{CONTENT_TYPE, self}; +use axum::http::header::{self, CONTENT_LENGTH, CONTENT_TYPE}; use axum::extract::State; use axum::http::{StatusCode, HeaderValue}; use axum::response::{Response, IntoResponse}; @@ -36,7 +36,10 @@ pub async fn get_qmdl(State(state): State>, Path(qmdl_name): Pa let limited_qmdl_file = qmdl_file.take(entry.qmdl_size_bytes as u64); let qmdl_stream = ReaderStream::new(limited_qmdl_file); - let headers = [(CONTENT_TYPE, "application/octet-stream")]; + let headers = [ + (CONTENT_TYPE, "application/octet-stream"), + (CONTENT_LENGTH, &entry.qmdl_size_bytes.to_string()), + ]; let body = Body::from_stream(qmdl_stream); Ok((headers, body).into_response()) }