Skip to content

Instantly share code, notes, and snippets.

@oliversuarez
Forked from adambgoode/http-get.java
Created July 6, 2023 17:16
Show Gist options
  • Save oliversuarez/156fe8412bcc0b7278f8cb98de57d34e to your computer and use it in GitHub Desktop.
Save oliversuarez/156fe8412bcc0b7278f8cb98de57d34e to your computer and use it in GitHub Desktop.
// HTTP Client GET
// Usage: jshell --add-modules jdk.incubator.httpclient http-get.jsh
import jdk.incubator.http.*
var client = HttpClient.newHttpClient()
var request = HttpRequest.newBuilder().uri(new URI("https://medium.com/adambgoode")).build()
var response = client.send(request, HttpResponse.BodyHandler.asString())
System.out.println(response.body())
/exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment