Fixes #5061: create generic method to check http status

I believe we should have an it ops knowledge for this, but what would be its name ?