Skip to content

Commit 1077d8f

Browse files
committed
try fix static
1 parent 6745ac9 commit 1077d8f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/web/routes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub(super) fn build_axum_routes() -> AxumRouter {
129129
"/favicon.ico",
130130
get_static(|| async { Redirect::permanent("/-/static/favicon.ico") }),
131131
)
132-
.nest("/-/static/", build_static_router())
132+
.nest("/-/static", build_static_router())
133133
.route(
134134
"/opensearch.xml",
135135
get_static(|| async { Redirect::permanent("/-/static/opensearch.xml") }),

src/web/statics.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ pub(crate) fn build_static_router() -> AxumRouter {
6767
"/rustdoc-2021-12-05.css",
6868
get_static(|| async { build_static_css_response(RUSTDOC_2021_12_05_CSS) }),
6969
)
70-
.nest_service(
71-
"/",
70+
.fallback_service(
7271
get_service(ServeDir::new("static").fallback(ServeDir::new("vendor")))
7372
.layer(middleware::from_fn(set_needed_static_headers))
7473
.layer(middleware::from_fn(|request, next| async {
@@ -166,7 +165,12 @@ mod tests {
166165
let web = env.web_app().await;
167166

168167
let resp = web.get(path).await?;
169-
assert!(resp.status().is_success());
168+
if !resp.status().is_success() {
169+
let status = resp.status();
170+
dbg!(&resp.text().await);
171+
assert!(status.is_success(), "{}", status);
172+
panic!("as");
173+
}
170174
resp.assert_cache_control(CachePolicy::ForeverInCdnAndBrowser, &env.config());
171175
assert_eq!(
172176
resp.headers().get("Content-Type"),

0 commit comments

Comments
 (0)