While the Prophet ﷺ was praying, he noticed some phlegm on the wall facing the qiblah of the mosque. He scraped it off with his hand and became visibly angry. Then he said, "When one of you is praying, Allah is directly before his face, so let none of you spit in front of him during the prayer."
بينا النبي ﷺ يصلي، رأى في قبلة المسجد نخامة، فحكها بيده، فتغيظ، ثم قال: إن أحدكم إذا كان في الصلاة، فإن الله حيال وجهه، فلا يتنخمن حيال وجهه في الصلاة.
Bukhari narrated it in al-Adab (6111) from Musa bin Ismail, who said, Juwayriyah narrated to us, from Nafi, from Abdullah, and he mentioned it.Malik narrated it in al-Qibla (5) from Nafi, from Abdullah bin Umar, similarly, but it does not mention the anger.Bukhari narrated it in al-Salah (406), and Muslim in al-Masajid (547), by way of Malik, with the same content.