Skip to content

Instantly share code, notes, and snippets.

@Janfy
Forked from gatanaso/http-client.jsh
Created January 3, 2024 18:22
Show Gist options
  • Save Janfy/33584b2e515a9483fbc34d58204183d5 to your computer and use it in GitHub Desktop.
Save Janfy/33584b2e515a9483fbc34d58204183d5 to your computer and use it in GitHub Desktop.
JShell http client example
import java.net.http.*;
var client = HttpClient.newHttpClient();
var uri = new URI("https://riimusolutions.com");
var request = HttpRequest.newBuilder().uri(uri).build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
/exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment