From d77553d826f3c90999e0dd84f35cac3690c3d0ca Mon Sep 17 00:00:00 2001 From: Michael Alyn Miller Date: Sat, 4 Dec 2021 16:49:06 -0800 Subject: Update axum to 0.4 (by switching to axum-core) --- askama_axum/Cargo.toml | 8 +++++--- askama_axum/src/lib.rs | 17 +++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'askama_axum') 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 "] 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: &T, ext: &str) -> axum::http::Response> { +pub fn into_response(t: &T, ext: &str) -> Response { match t.render() { Ok(body) => Response::builder() .status(StatusCode::OK) @@ -15,11 +16,11 @@ pub fn into_response(t: &T, ext: &str) -> axum::http::Response Response::builder() .status(StatusCode::INTERNAL_SERVER_ERROR) - .body(vec![].into()) + .body(body::boxed(Empty::new())) .unwrap(), } } -- cgit