move response body check into helper function