Validate http response status code and return error when invalid.
Validate http response status code and return error when invalid.