move header and response logic to framework