public static void initRequestEntity(HttpRequestBase requestBase, Object body, Header header) throws Exception {
        if (body == null) {
            return;
        }
        if (requestBase instanceof HttpEntityEnclosingRequest) {
            HttpEntityEnclosingRequest request = (HttpEntityEnclosingRequest) requestBase;
            MediaType mediaType = MediaType.valueOf(header.getValue(HttpHeaderConsts.CONTENT_TYPE));
            ContentType contentType = ContentType.create(mediaType.getType(), mediaType.getCharset());
            HttpEntity entity;
            if (body instanceof byte[]) {
                entity = new ByteArrayEntity((byte[]) body, contentType);
            } else {
                entity = new StringEntity(body instanceof String ? (String) body : JacksonUtils.toJson(body),
                        contentType);
            }
            request.setEntity(entity);
        }
    }
@Test
    void testInitRequestEntity2() throws Exception {
        BaseHttpMethod.HttpGetWithEntity httpRequest = new BaseHttpMethod.HttpGetWithEntity("");
        Header header = Header.newInstance();
        header.addParam(HttpHeaderConsts.CONTENT_TYPE, "text/html");
        
        HttpUtils.initRequestEntity(httpRequest, Collections.singletonMap("k", "v"), header);
        
        HttpEntity entity = httpRequest.getEntity();
        InputStream contentStream = entity.getContent();
        byte[] bytes = new byte[contentStream.available()];
        contentStream.read(bytes);
        assertEquals("{\"k\":\"v\"}", new String(bytes, Constants.ENCODE));
        assertEquals(HttpHeaderConsts.CONTENT_TYPE, entity.getContentType().getName());
        assertEquals("text/html; charset=UTF-8", entity.getContentType().getValue());
    }