refactor http request