How to Trigger a Synchronous GET Request

For triggering a synchronous GET request we can rely on HTTP Client API as follows:

HttpClient client = HttpClient.newHttpClient();HttpRequest request = HttpRequest.newBuilder()                   .uri(URI.create("https://reqres.in/api/users/2"))                    .build();HttpResponse response = client.send(request, BodyHandlers.ofString());
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Related Posts