Fixes #5061: create generic method to check http status

Please remove the colon from this log message, it will already have a colon in from the default log message ("Promise kept, not doing anything: ${your log message}"