refactor http client