Move HTTP response handling to a separate handler.