fixes #5344
Merge pull request #5365 from dotCMS/issue-5344-test-api-call-cause-infinie-loop

fixes #5344