aboutsummaryrefslogtreecommitdiffstats
path: root/askama_axum/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_axum/src/lib.rs17
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(),
}
}