blob: da3d699023968115984c8459619212eb79618ab8 (
plain) (
tree)
|
|
#![forbid(unsafe_code)]
#![deny(elided_lifetimes_in_paths)]
#![deny(unreachable_pub)]
pub use askama::*;
pub use axum_core::response::{IntoResponse, Response};
use http::StatusCode;
pub fn into_response<T: Template>(t: &T, _ext: &str) -> Response {
match t.render() {
Ok(body) => {
let headers = [(
http::header::CONTENT_TYPE,
http::HeaderValue::from_static(T::MIME_TYPE),
)];
(headers, body).into_response()
}
Err(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
}
}
|