Sending a request synchronously

We've already done this in the previous problems, and so we will just provide you with a quick remainder, as follows:

HttpClient client = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://reqres.in/api/users/2"))
.build();

HttpResponse<String> response
= client.send(request, HttpResponse.BodyHandlers.ofString());
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.174.23