diff options
author | Michael Alyn Miller <malyn@strangeGizmo.com> | 2021-12-04 16:49:06 -0800 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-12-05 10:00:02 +0100 |
commit | d77553d826f3c90999e0dd84f35cac3690c3d0ca (patch) | |
tree | 1e85deec731e92dbaca13a00c530f86ebefeeeaf /askama_axum/src/lib.rs | |
parent | e0daa9b83a1a69ff955333eed8c0dddb0f438aaf (diff) | |
download | askama-d77553d826f3c90999e0dd84f35cac3690c3d0ca.tar.gz askama-d77553d826f3c90999e0dd84f35cac3690c3d0ca.tar.bz2 askama-d77553d826f3c90999e0dd84f35cac3690c3d0ca.zip |
Update axum to 0.4 (by switching to axum-core)
Diffstat (limited to '')
-rw-r--r-- | askama_axum/src/lib.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/askama_axum/src/lib.rs b/askama_axum/src/lib.rs index 0c21464..859b19e 100644 --- a/askama_axum/src/lib.rs +++ b/askama_axum/src/lib.rs @@ -1,13 +1,14 @@ #![deny(elided_lifetimes_in_paths)] pub use askama::*; -use axum::{ - self, - body::{Bytes, Full}, - http::{Response, StatusCode}, -}; +use axum_core::body; +pub use axum_core::body::BoxBody; +pub use axum_core::response::IntoResponse; +pub use http::Response; +use http::StatusCode; +use http_body::{Empty, Full}; -pub fn into_response<T: Template>(t: &T, ext: &str) -> axum::http::Response<Full<Bytes>> { +pub fn into_response<T: Template>(t: &T, ext: &str) -> Response<BoxBody> { match t.render() { Ok(body) => Response::builder() .status(StatusCode::OK) @@ -15,11 +16,11 @@ pub fn into_response<T: Template>(t: &T, ext: &str) -> axum::http::Response<Full "content-type", askama::mime::extension_to_mime_type(ext).to_string(), ) - .body(body.into()) + .body(body::boxed(Full::from(body))) .unwrap(), Err(_) => Response::builder() .status(StatusCode::INTERNAL_SERVER_ERROR) - .body(vec![].into()) + .body(body::boxed(Empty::new())) .unwrap(), } } |