compartmentlize web server response modification logic