mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-02 15:25:19 +00:00
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.
This commit is contained in:
parent
f88403430b
commit
c441459a27
@ -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("}")
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user