| 5 | import java.nio.charset.Charset; |
| 6 | |
| 7 | public 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected