Whenever the entry does not exist for a given eventName, you
which initializes that entry with the nestedEventInfo map. This is a specific map instance. It is the same map every time. So eventInfo["GET"] and eventInfo["POST"] end up both referencing the same map, nestedEventInfo.
Thanks for the reply. I think the problem is that Event() adds everything into the same global map eventInfo.
The first call adds a new “GET” element to eventInfo.
The second call finds a “GET” element and increases the count.
The third call adds a new “POST” element to eventInfo. Now eventInfo contains two elements.
If the third call shall just output map[POST:map[1:1]], then Event() needs to either delete the “GET” element first, or create a new map each time. This depends on what you want to achieve with this code.
Edited to add: The issue that @calmh explained is a separate one and also needs to get fixed.