Skip to content

Commit

Permalink
Remove _ext from askama_hyper, too
Browse files Browse the repository at this point in the history
That part was missing from #632, because #632 came before #706, and I
forgot to update the older PR.
  • Loading branch information
Kijewski authored and djc committed Sep 26, 2022
1 parent f884034 commit c441459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions askama_derive/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("}")
}
Expand Down
6 changes: 3 additions & 3 deletions askama_hyper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down

0 comments on commit c441459

Please sign in to comment.