Refactor http request.