Fixes #5061: create generic method to check http status

i thought previous line would be enough