This is from Daniel Chapter 1.
Daniel got taken away by the Babylonians. His friends, whom the Babylonians renamed Shadrach, Meshach, and Abednego, went with him. They got sent to the palace. They were healthy and all of the stuff that the king liked. (I suspect this was part of a brainwashing program to create Babylonian loyalists or something of that sort.)
They were given a certain diet by the king. However, it violated the Hebrew diet. While others might not have cared, they did. They asked to not be on this sinful diet.
The king’s guy in charge of them said that he could lose his head if their heath was bad if he let them go off the diet. He said that it would be their fault if that happened to him.
They got him to agree that if they were just as healthy staying on what was right, that they could continue. They would have a 10 day trial period. If they failed, they agreed to be punished. Working to get around a bad law without having to riot or fight or openly break it is always a good idea.
After 10 days, they not only were as healthy as the others, they were healthier. God always blesses those who obey him. Later, they further advanced in the king’s favor. It always pays to obey God.