This commit is contained in:
Mateusz Gruszczyński committed 2026-10-08 23:36:27 +02:00
1 parent 68678e98be
commit b3bc56cd42
16 files changed
+230 -54

No files matched your search

+10 -6
View File
@@ -11,6 +11,15 @@ fn request_id_hash(sequence: u64) -> String {
format!("{:x}", hash.finalize())
}
fn should_replace_error_page(response: &Response, minimal_welcome: bool) -> bool {
!minimal_welcome
&& response.extensions().get::<ErrorFallbackResponse>().is_none()
&& response
.extensions()
.get::<crate::tinyauth::AuthenticationFailure>()
.is_none()
}
async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next) -> Response {
let snapshot = state.config.load_full();
let (frontend_context, route_context) = response_context(&snapshot, &request);
@@ -205,12 +214,7 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
.as_ref()
.and_then(|f| f.pages.errors.get(&code))
.or_else(|| snapshot.envelope.config.pages.errors.get(&code));
if !minimal_welcome
&& response
.extensions()
.get::<crate::tinyauth::AuthenticationFailure>()
.is_none()
{
if should_replace_error_page(&response, minimal_welcome) {
if let Some(page) = custom_error {
crate::pages::replace_error(&mut response, page);
}