1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 09:57:01 +00:00
This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-04-23 13:18:54 +03:00
parent 90750d089d
commit 677ddd7539
4 changed files with 30 additions and 27 deletions

View File

@@ -334,6 +334,20 @@ func (s *JetEngine) ExecuteWriter(w io.Writer, filename string, layout string, b
}
}
if viewContextData := ctx.GetViewData(); len(viewContextData) > 0 { // fix #1876
if vars == nil {
vars = make(JetRuntimeVars)
}
for k, v := range viewContextData {
val, ok := v.(reflect.Value)
if !ok {
val = reflect.ValueOf(v)
}
vars[k] = val
}
}
if v := ctx.Values().Get(s.jetDataContextKey); v != nil {
if bindingData == nil {
// if bindingData is nil, try to fill them by context key (a middleware can set data).
@@ -348,6 +362,7 @@ func (s *JetEngine) ExecuteWriter(w io.Writer, filename string, layout string, b
}
}
}
}
if bindingData == nil {