refactoring http client