Fixes #5061: create generic method to check http status

Please clarify as follows:

> Perform a HTTP request on the URL, method and headers provided and check that the response has the expected status code (ie 200, 404, 503, etc).