Yahya related to me from Malik from Hisham ibn Urwa from his father that Hamza ibn Amr al-Aslami once said to the Messenger of Allah ﷺ "Messenger of Allah, I am a man who fasts. Can I fast when travelling?" The Messenger of Allah ﷺ said, "If you want you can fast, and if you want you can break the fast."
قَالَ لِرَسُولِ اللَّهِ ﷺ يَا رَسُولَ اللَّهِ إِنِّي رَجُلٌ أَصُومُ أَفَأَصُومُ فِي السَّفَرِ فَقَالَ لَهُ رَسُولُ اللَّهِ ﷺ إِنْ شِئْتَ فَصُمْ وَإِنْ شِئْتَ فَأَفْطِرْ