MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / HttpsRequest

Class HttpsRequest

Programs/HttpsRequest.java:7–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import java.nio.charset.Charset;
6
7public class HttpsRequest {
8 public static void main(String[] args) {
9 var request = HttpRequest.newBuilder(URI.create("https://github.com/"))
10 .GET()
11 .build();
12 //Prints the status Code of the HTTP-Request
13 HttpClient.newHttpClient()
14 .sendAsync(request, HttpResponse.BodyHandlers.ofString(Charset.defaultCharset()))
15 .thenApply(HttpResponse::statusCode)
16 .thenAccept(System.out::println)
17 .join();
18 }
19}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected