Skip to content

Instantly share code, notes, and snippets.

@gatanaso
Created May 13, 2020 07:59
Show Gist options
  • Save gatanaso/cc5e65b99c5d7b8786e2d38d0bc1bb05 to your computer and use it in GitHub Desktop.
Save gatanaso/cc5e65b99c5d7b8786e2d38d0bc1bb05 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