feat(tvix/nar-bridge): send content-type headers

This prevents browsers from treating NARInfo and nix-cache-info paths as
a separate "Download", but just show it in plaintext.

Change-Id: If99abe20ef1d24e4fa86c055160861ca47aa81ce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12267
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
Florian Klink 2024-08-23 10:34:53 +03:00 committed by clbot
parent 35d5811eec
commit a4ebc8da7c
3 changed files with 18 additions and 9 deletions

View file

@ -77,6 +77,7 @@ pub async fn get(
.status(StatusCode::OK)
.header("cache-control", "max-age=31536000, immutable")
.header("content-length", nar_size)
.header("content-type", nix_http::MIME_TYPE_NAR)
.body(Body::from_stream(ReaderStream::new(r)))
.unwrap())
}