http client refactoring