Imam Baihaqi has stated on the authority of Hadhrat Ali (ra) who stated: “Once, I was present with the Prophet (peace be upon him). At that time, I had fallen so much sick that I prayed to Allah Almighty to grant me death if I am destined to die so that I may get relief from the sickness, otherwise, I may be restored to normal health from the sickness if I have to live for sometime. I, also, prayed for being granted patience if this sickness is a test for me from Allah Almighty.” Hearing that, the Prophet beat Ali with his foot and observed: “Oh Ali! repeat what you were saying.” Ali (ra) repeated his prayer. Then the Prophet prayed to Allah Almighty: “O Allah! Heal him from the sickness.” Ali (ra) stated that he became healthy the same day and the pain never appeared again.
Source: From the book “The Miracles of the Prophet Muhammad” by Shaikh Ahmed Saeed Dehalvi. read quran online