Extracting ensureStatusCodeIsGood method