@GetMapping
    @TpsControl(pointName = "NamingInstanceQuery", name = "HttpNamingInstanceQuery")
    @Secured(action = ActionTypes.READ)
    public ObjectNode detail(HttpServletRequest request) throws Exception {
        
        String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID);
        String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME);
        NamingUtils.checkServiceNameFormat(serviceName);
        String cluster = WebUtils.optional(request, CommonParams.CLUSTER_NAME, UtilsAndCommons.DEFAULT_CLUSTER_NAME);
        String ip = WebUtils.required(request, "ip");
        int port = Integer.parseInt(WebUtils.required(request, "port"));
        
        com.alibaba.nacos.api.naming.pojo.Instance instance = getInstanceOperator().getInstance(namespaceId,
                serviceName, cluster, ip, port);
        ObjectNode result = JacksonUtils.createEmptyJsonNode();
        result.put("service", serviceName);
        result.put("ip", ip);
        result.put("port", port);
        result.put("clusterName", cluster);
        result.put("weight", instance.getWeight());
        result.put("healthy", instance.isHealthy());
        result.put("instanceId", instance.getInstanceId());
        result.set(METADATA, JacksonUtils.transferToJsonNode(instance.getMetadata()));
        return result;
    }
@Test
    void testDetail() throws Exception {
        Instance instance = new Instance();
        instance.setIp("1.1.1.1");
        instance.setPort(3306);
        instance.setInstanceId("testId");
        instance.setClusterName(UtilsAndCommons.DEFAULT_CLUSTER_NAME);
        when(instanceServiceV2.getInstance(Constants.DEFAULT_NAMESPACE_ID, TEST_GROUP_NAME + "@@" + TEST_SERVICE_NAME,
                UtilsAndCommons.DEFAULT_CLUSTER_NAME, "1.1.1.1", 3306)).thenReturn(instance);
        ObjectNode actual = instanceController.detail(request);
        assertEquals(TEST_GROUP_NAME + "@@" + TEST_SERVICE_NAME, actual.get("service").textValue());
        assertEquals("1.1.1.1", actual.get("ip").textValue());
        assertEquals(3306, actual.get("port").intValue());
        assertEquals(UtilsAndCommons.DEFAULT_CLUSTER_NAME, actual.get("clusterName").textValue());
        assertEquals(1.0D, actual.get("weight").doubleValue(), 0.1);
        assertTrue(actual.get("healthy").booleanValue());
        assertEquals("testId", actual.get("instanceId").textValue());
        assertEquals("{}", actual.get("metadata").toString());
    }