aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2022-09-26 16:51:25 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-09-26 17:35:18 +0200
commitc441459a27eb7c0c476ce70833e05224ba6894fd (patch)
tree07a1989315659379f21dcbec41637cad43f62700
parentf88403430bd1f998a1688bf8329ba5071904219b (diff)
downloadaskama-c441459a27eb7c0c476ce70833e05224ba6894fd.tar.gz
askama-c441459a27eb7c0c476ce70833e05224ba6894fd.tar.bz2
askama-c441459a27eb7c0c476ce70833e05224ba6894fd.zip
Remove `_ext` from `askama_hyper`, too
That part was missing from #632, because #632 came before #706, and I forgot to update the older PR.
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs3
-rw-r--r--askama_hyper/src/lib.rs6
2 files changed, 4 insertions, 5 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 48a3798..08c1de1 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -445,8 +445,7 @@ impl<'a> Generator<'a> {
"{} {{",
quote!(fn from(value: &#ident #orig_ty_generics) -> Self)
))?;
- let ext = self.input.extension().unwrap_or("txt");
- buf.writeln(&format!("::askama_hyper::respond(value, {:?})", ext))?;
+ buf.writeln("::askama_hyper::respond(value)")?;
buf.writeln("}")?;
buf.writeln("}")
}
diff --git a/askama_hyper/src/lib.rs b/askama_hyper/src/lib.rs
index 07ede88..5032da2 100644
--- a/askama_hyper/src/lib.rs
+++ b/askama_hyper/src/lib.rs
@@ -7,7 +7,7 @@ pub use askama::*;
pub use hyper;
use hyper::{header, Body, Response, StatusCode};
-pub fn try_respond<T: Template>(t: &T, _ext: &str) -> Result<Response<Body>> {
+pub fn try_respond<T: Template>(t: &T) -> Result<Response<Body>> {
Response::builder()
.status(StatusCode::OK)
.header(
@@ -18,8 +18,8 @@ pub fn try_respond<T: Template>(t: &T, _ext: &str) -> Result<Response<Body>> {
.map_err(|err| Error::Custom(Box::new(err)))
}
-pub fn respond<T: Template>(t: &T, _ext: &str) -> Response<Body> {
- match try_respond(t, _ext) {
+pub fn respond<T: Template>(t: &T) -> Response<Body> {
+ match try_respond(t) {
Ok(response) => response,
Err(_) => Response::builder()
.status(StatusCode::INTERNAL_SERVER_ERROR)