forked from kevin.shehu/GGD
ADD: NEW CHANGES
FIX : Reworked ApiCall FIX : Reworked Rule Engine FIX : Reworked drl files
This commit is contained in:
@@ -9,7 +9,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class HttpPost {
|
||||
public String HttpCallPost (String baseUrl, String body) throws Exception {
|
||||
public String HttpCallPost(String baseUrl, String body) throws Exception {
|
||||
|
||||
var client = HttpClient.newBuilder()
|
||||
.version(HttpClient.Version.HTTP_1_1)
|
||||
@@ -21,22 +21,14 @@ public class HttpPost {
|
||||
.POST(HttpRequest.BodyPublishers.ofString(body))
|
||||
.setHeader("Content-Type", "application/json")
|
||||
.setHeader("Accept", "application/json")
|
||||
.header("Authority", "https://api.whysor.com/")
|
||||
.build();
|
||||
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
||||
// .thenApply(HttpResponse::body)
|
||||
// .thenAccept(System.out::println)
|
||||
// .join();
|
||||
|
||||
CompletableFuture<HttpResponse<String>> response = client.sendAsync(request, HttpResponse.BodyHandlers.ofString());
|
||||
String result = response.thenApply(HttpResponse::body).get(5, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user