| 811 | } |
| 812 | |
| 813 | func (c *DefaultCtx) renderExtensions(bind any) { |
| 814 | if bindMap, ok := bind.(Map); ok { |
| 815 | // Bind view map |
| 816 | for key, value := range c.viewBindMap { |
| 817 | if _, ok := bindMap[key]; !ok { |
| 818 | bindMap[key] = value |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | // Check if the PassLocalsToViews option is enabled (by default it is disabled) |
| 823 | if c.app.config.PassLocalsToViews { |
| 824 | // Loop through each local and set it in the map |
| 825 | c.fasthttp.VisitUserValues(func(key []byte, val any) { |
| 826 | // check if bindMap doesn't contain the key |
| 827 | if _, ok := bindMap[c.app.toString(key)]; !ok { |
| 828 | // Set the key and value in the bindMap |
| 829 | bindMap[c.app.toString(key)] = val |
| 830 | } |
| 831 | }) |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | c.app.mountFields.appListKeysOnce.Do(c.app.generateAppListKeys) |
| 836 | } |
| 837 | |
| 838 | // Bind You can bind body, cookie, headers etc. into the map, map slice, struct easily by using Binding method. |
| 839 | // It gives custom binding support, detailed binding options and more. |