West Ham var i perioder klart bedre end Leicester, men blev presset til det yderste, da unge Harvey Barnes udlignede til slut.