refactor http req/res