public static String doPostWithJsonRequestBody()

in shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/util/HttpClientUtil.java [125:135]


    public static String doPostWithJsonRequestBody(final String url, final String requestBody) throws IOException {
        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setConfig(RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build());
            httpPost.setHeader("Content-type", "application/json");
            StringEntity requestEntity = new StringEntity(requestBody, ENCODING);
            requestEntity.setContentEncoding(ENCODING);
            httpPost.setEntity(requestEntity);
            return getHttpClientResult(httpClient, httpPost);
        }
    }