MULE-8018: Merge http connector code cleanup

I can't know the type of the entity in advance so how would I avoid having an if statement?