♻️ Exige la petición en las variantes de ErrorPage
Sustituye `Option<HttpRequest>` por `HttpRequest` en todas las variantes. Ningún uso construía un ErrorPage sin petición y, sin ella, la página de error pierde el idioma negociado y el usuario actual.
This commit is contained in:
parent
947aef2f91
commit
a6d15ab211
13 changed files with 59 additions and 62 deletions
|
|
@ -45,7 +45,7 @@ pub(crate) async fn reject_cross_origin(request: Request, next: Next) -> Respons
|
|||
);
|
||||
let (mut parts, _) = request.into_parts();
|
||||
let Ok(request) = HttpRequest::from_request_parts(&mut parts, &()).await;
|
||||
ErrorPage::AccessDenied(Some(request)).into_response()
|
||||
ErrorPage::AccessDenied(request).into_response()
|
||||
}
|
||||
|
||||
// Con HTTP/2 el servidor llega en la URI (`:authority`) y no siempre en `Host`.
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ const FORWARDED_HEADERS: [http::HeaderName; 6] = [
|
|||
/// .serve(&request)
|
||||
/// .await
|
||||
/// .map_err(|err| match err {
|
||||
/// web::UploadError::NotFound(_) => ErrorPage::NotFound(Some(request)),
|
||||
/// _ => ErrorPage::InternalError(Some(request)),
|
||||
/// web::UploadError::NotFound(_) => ErrorPage::NotFound(request),
|
||||
/// _ => ErrorPage::InternalError(request),
|
||||
/// })
|
||||
/// }
|
||||
/// ```
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ impl Drop for SavedFiles {
|
|||
/// // Volver a mostrar el formulario con `err.message()`...
|
||||
/// # todo!()
|
||||
/// }
|
||||
/// Err(_) => return Err(ErrorPage::InternalError(Some(request))),
|
||||
/// Err(_) => return Err(ErrorPage::InternalError(request)),
|
||||
/// };
|
||||
/// let Some(photo) = sent.file("photo") else {
|
||||
/// // Campo obligatorio sin archivo: volver a mostrar el formulario...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue