It's literally a crime for any of those reasons to assault anyone in countries I'm at least a bit familiar with, for any cop or private citizen.
Someone who spits in you face should be persecuted.
Someone who punches someone should be prosecuted.
These are the basics of law.
Otherwise it would be justified to punch a cop back in the face bcs they punched me in the face (bcs I spit in their face). It doesn't end. The legal system is there literally to prevent that endless cycle of violence (unless in prefect anarchy with diligent participants, but nobody is arguing that here since "a cop" existing voids that theoretical case).