refactor http methods. catch errors