Animals not always eat healthy things, and when they accidently chomp something poisonous they must get rid of it or they die. Some excrete it with what leaves the backside, others spit or sweat... and a few use it for later. This ability to store poison of plants or prey animals can be found at snails, fishes, frogs, the mane rat, manticors
and also, in rare cases, birds. They store the poison in their feathers and skin which makes them inedible for any predator.
It's a ability which seams to come and go several times in evolution and I wouldn't surprised if one or two dinosaurs evolve it likewise.
I choose Beipiaosaurus for this All Yesterdays experiment. I could imagine that the switch between meat- and plant-eating-livestyle brings some challanges with it. Meat is much more easier to diggest and have, normally, no toxic substances. In addition these small herbivores were probably not fast enough and not armoured to defy bigger predatores. The big claws could be helpfull but their defense function is uncertain for me.
A good defense is always to have a disrepute. Here the Beipiaosaurus eats young yew shoots (yews are known from the Jehol biota) which he stores in it's skin and in it's longer, pointed stage-one-feathers.