If I eat onion once in a while, I would get diarrhea from eating it. If I eat it often, I would build up tolerance and only get gas. But that's the best case; I cannot be completely unaffected.
Onion is not the only trigger; garlic, and other stuff also gives me gas but I haven't narrowed down all of them. I'm in my 50s and this problem has plagued me for maybe 20 or more years. I don't have this issue when I was in college or earlier.
What might be the problem? Can I narrow it down myself? Is there some tests I can ask my doctor to perform?