본문 바로가기
Java

unirest https url 적용

by 자바초보자 2022. 6. 14.
728x90

unirest doc

//http://kong.github.io/unirest-java/#requests

 

 

SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy() {
        public boolean isTrusted(X509Certificate[] chain, String authType) {
            return true;
        }
    }).build();
    HttpClient customHttpClient = HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
    Unirest.setHttpClient(customHttpClient);

 

 

 

 

/*
HttpRequestWithBody req = (requestMethod == "POST" ? Unirest.post(urlStr) : Unirest.put(urlStr));
req.header("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundaryyEmKNDsBKjB7QEqu");
req.header("Authorization", authorization);
*/
/*
MultipartBody body = Unirest.post(urlStr)
.header("Authorization", authorization)
.header("Content-Type", "multipart/form-data; boundary=*******************************************************************************")
     .field("properties", "1111")
     .field("contents", "2222");
HttpResponse<String> hres = body.asString();

 

 

 

 

728x90