From d92359c77878380f42091d2ad9f72a7968bdeb5e Mon Sep 17 00:00:00 2001 From: strawberry Date: Thu, 5 Dec 2024 22:15:38 -0500 Subject: [PATCH] fix application/x-nix-nar Content-Type not being applied Signed-off-by: strawberry --- server/src/api/binary_cache.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/server/src/api/binary_cache.rs b/server/src/api/binary_cache.rs index 6795cff..02e4857 100644 --- a/server/src/api/binary_cache.rs +++ b/server/src/api/binary_cache.rs @@ -9,6 +9,7 @@ use std::io::{Error as IoError, ErrorKind as IoErrorKind}; use std::path::PathBuf; use std::sync::Arc; +use axum::http; use axum::{ body::Body, extract::{Extension, Path}, @@ -223,7 +224,14 @@ async fn get_nar( }); let body = Body::from_stream(stream); - Ok(body.into_response()) + Ok(( + [( + http::header::CONTENT_TYPE, + http::HeaderValue::from_static(mime::NAR), + )], + body, + ) + .into_response()) } } } else { @@ -260,7 +268,14 @@ async fn get_nar( }); let body = Body::from_stream(merged); - Ok(body.into_response()) + Ok(( + [( + http::header::CONTENT_TYPE, + http::HeaderValue::from_static(mime::NAR), + )], + body, + ) + .into_response()) } }