Fixes #5061: create generic method to check http status

we'll need to upgrade our stdlib then