<dependency> <groupId>com.mashape.unirest</groupId> <artifactId>unirest-java</artifactId> <version>1.4.9</version> </dependency> String url = "http://example.com/api/endpoint"; JSONObject requestData = new JSONObject(); requestData.put("key1", "value1"); requestData.put("key2", "value2"); HttpResponse<JsonNode> response = Unirest.post(url) .header("Content-Type", "application/json") .body(requestData) .asJson(); HttpResponse<JsonNode> response = Unirest.get(url) .asJson(); JsonNode jsonResponse = response.getBody(); Unirest.config().verifySsl(false); String proxyUrl = "http://your-proxy-url:port"; Unirest.config().proxy(proxyUrl);


上一篇:
下一篇:
切换中文