feat(bundled-binary): add a test

This commit is contained in:
Edouard Vanbelle
2026-08-29 02:17:02 +02:00
parent e562a3de30
commit 5c956c9bde
8 changed files with 412 additions and 29 deletions
+6 -5
View File
@@ -108,9 +108,8 @@ fn asset_response(path: &str, bytes: std::borrow::Cow<'static, [u8]>) -> Respons
let mut resp = Response::new(Body::from(bytes.into_owned()));
resp.headers_mut().insert(
CONTENT_TYPE,
HeaderValue::from_str(mime.as_ref()).unwrap_or(HeaderValue::from_static(
"application/octet-stream",
)),
HeaderValue::from_str(mime.as_ref())
.unwrap_or(HeaderValue::from_static("application/octet-stream")),
);
resp
}
@@ -119,8 +118,10 @@ fn spa_shell_response() -> Response {
match EmbeddedAssets::get("index.html") {
Some(shell) => {
let mut resp = Response::new(Body::from(shell.data.into_owned()));
resp.headers_mut()
.insert(CONTENT_TYPE, HeaderValue::from_static("text/html; charset=utf-8"));
resp.headers_mut().insert(
CONTENT_TYPE,
HeaderValue::from_static("text/html; charset=utf-8"),
);
// Belt: the parent module also stamps this on unset,
// but stamp it here too so the shell never accidentally
// ends up cacheable in front of a deploy.
+1 -4
View File
@@ -126,10 +126,7 @@ pub fn resolve_static_path(config: &AppConfig) -> PathBuf {
/// Caching: content-hashed assets under `/_app/immutable` are cached forever;
/// everything else — crucially the `index.html` shell — is `no-cache` so a deploy
/// can't leave a stale app pinned in browsers.
pub fn create_web_routes(
app_state: Arc<AppState>,
source: StaticSource,
) -> Router<Arc<AppState>> {
pub fn create_web_routes(app_state: Arc<AppState>, source: StaticSource) -> Router<Arc<AppState>> {
// `source` is resolved ONCE at boot in `main.rs::run()` and passed
// in — see the sequence there. Previously this fn called
// `AppConfig::from_env()` + `resolve_static_source(&config)` itself