Fixes #5061: create generic method to check http status

What is the "999" return code? IIRC this is not a valid return code.

I see two options here:
- You're using it to avoid using that feature. If so, please document this (a comment will suffice)
- You expect the command to return 999, but it never will...