1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 18:37:05 +00:00

Update to version 8.5.1. It contains a minor fix. Read HISTORY.md

https://github.com/kataras/iris/blob/master/HISTORY.md#tu-10-october-2017--v851

Former-commit-id: af1424c691613ccde911bef7d1371aa52e6abb79
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-10-10 16:58:14 +03:00
parent 713e5c3362
commit de3fc8ae46
11 changed files with 122 additions and 15 deletions

View File

@@ -347,7 +347,19 @@ func (c *Controller) EndRequest(ctx context.Context) {
ctx.ViewLayout(layout)
}
if len(c.Data) > 0 {
ctx.Values().Set(ctx.Application().ConfigurationReadOnly().GetViewDataContextKey(), c.Data)
dataKey := ctx.Application().ConfigurationReadOnly().GetViewDataContextKey()
// In order to respect any c.Ctx.ViewData that may called manually before;
if ctx.Values().Get(dataKey) == nil {
// if no c.Ctx.ViewData then it's empty do a
// pure set, it's faster.
ctx.Values().Set(dataKey, c.Data)
} else {
// else do a range loop and set the data one by one.
for k, v := range c.Data {
ctx.ViewData(k, v)
}
}
}
ctx.View(view)