aboutsummaryrefslogtreecommitdiffstats
path: root/askama_axum
diff options
context:
space:
mode:
Diffstat (limited to 'askama_axum')
-rw-r--r--askama_axum/Cargo.toml8
-rw-r--r--askama_axum/src/lib.rs17
2 files changed, 14 insertions, 11 deletions
diff --git a/askama_axum/Cargo.toml b/askama_axum/Cargo.toml
index 7d3045d..998f54a 100644
--- a/askama_axum/Cargo.toml
+++ b/askama_axum/Cargo.toml
@@ -1,7 +1,6 @@
[package]
name = "askama_axum"
version = "0.10.0"
-authors = ["Michael Alyn Miller <malyn@strangeGizmo.com>"]
edition = "2018"
description = "Axum integration for Askama templates"
keywords = ["markup", "template", "jinja2", "html", "axum"]
@@ -14,10 +13,13 @@ workspace = ".."
readme = "README.md"
[dependencies]
-askama = { version = "0.11.0-beta.1", path = "../askama", default-features = false, features = ["with-axum", "mime", "mime_guess"] }
-axum = { version = "0.3", default-features = false }
+askama = { version = "0.11.0", path = "../askama", default-features = false, features = ["with-axum", "mime", "mime_guess"] }
+axum-core = "0.1"
+http = "0.2"
+http-body = "0.4"
[dev-dependencies]
+axum = { version = "0.4", default-features = false }
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1.0", features = ["full"] }
tower = { version = "0.4", features = ["util"] } \ No newline at end of file
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(),
}
}