Refactor http post request