Refactors https request