Add check for valid http status codes, if not throw error