refactor http promises