@@ -2,7 +2,7 @@ use crate::templates::SplitTemplate;
2
2
use crate :: AppState ;
3
3
use anyhow:: Context as AnyhowContext ;
4
4
use async_recursion:: async_recursion;
5
- use handlebars:: { Context , Handlebars , JsonValue , RenderError , Renderable } ;
5
+ use handlebars:: { Context , Handlebars , JsonValue , RenderError , Renderable , BlockContext } ;
6
6
use serde:: Serialize ;
7
7
use serde_json:: { json, Value } ;
8
8
use std:: borrow:: Cow ;
@@ -288,6 +288,7 @@ impl<'reg> SplitTemplateRenderer<'reg> {
288
288
) -> Result < ( ) , RenderError > {
289
289
if let Some ( local_vars) = self . local_vars . take ( ) {
290
290
let mut render_context = handlebars:: RenderContext :: new ( None ) ;
291
+ render_context. push_block ( BlockContext :: new ( ) ) ;
291
292
let blk = render_context
292
293
. block_mut ( )
293
294
. expect ( "context created without block" ) ;
@@ -349,7 +350,7 @@ mod tests {
349
350
rdr. render_item ( & mut output, json ! ( { "x" : 1 } ) ) ?;
350
351
rdr. render_item ( & mut output, json ! ( { "x" : 2 } ) ) ?;
351
352
rdr. render_end ( & mut output) ?;
352
- assert_eq ! ( output, b "Hello SQL ! (1 : SQL) (2 : SQL) Goodbye SQL") ;
353
+ assert_eq ! ( String :: from_utf8_lossy ( & output) , "Hello SQL ! (1 : SQL) (2 : SQL) Goodbye SQL" ) ;
353
354
Ok ( ( ) )
354
355
}
355
356
}
0 commit comments