1- use super :: TemplateData ;
21use crate :: web:: { csp:: Csp , error:: AxumNope } ;
32use axum:: {
43 body:: Body ,
@@ -25,7 +24,7 @@ macro_rules! impl_axum_webpage {
2524 $( , cpu_intensive_rendering = $cpu_intensive_rendering: expr) ?
2625 $( , ) ?
2726 ) => {
28- impl crate :: web:: page:: web_page:: AddCspNonce for $page {
27+ impl $ crate:: web:: page:: web_page:: AddCspNonce for $page {
2928 fn render_with_csp_nonce( & mut self , csp_nonce: String ) -> rinja:: Result <String > {
3029 self . csp_nonce = csp_nonce;
3130 self . render( )
@@ -103,7 +102,6 @@ pub(crate) struct DelayedTemplateRender {
103102
104103fn render_response (
105104 mut response : AxumResponse ,
106- bla : Arc < TemplateData > ,
107105 csp_nonce : String ,
108106) -> BoxFuture < ' static , AxumResponse > {
109107 async move {
@@ -138,7 +136,6 @@ fn render_response(
138136 } else {
139137 return render_response (
140138 AxumNope :: InternalError ( err. into ( ) ) . into_response ( ) ,
141- bla,
142139 csp_nonce,
143140 )
144141 . await ;
@@ -159,12 +156,6 @@ fn render_response(
159156}
160157
161158pub ( crate ) async fn render_templates_middleware ( req : AxumRequest , next : Next ) -> AxumResponse {
162- let templates: Arc < TemplateData > = req
163- . extensions ( )
164- . get :: < Arc < TemplateData > > ( )
165- . expect ( "template data request extension not found" )
166- . clone ( ) ;
167-
168159 let csp_nonce = req
169160 . extensions ( )
170161 . get :: < Arc < Csp > > ( )
@@ -174,5 +165,5 @@ pub(crate) async fn render_templates_middleware(req: AxumRequest, next: Next) ->
174165
175166 let response = next. run ( req) . await ;
176167
177- render_response ( response, templates , csp_nonce) . await
168+ render_response ( response, csp_nonce) . await
178169}
0 commit comments