Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // create an HttpRequest instance
- HttpRequest request = HttpRequest.newBuilder()
- .uri(URI.create("https://httpbin.io/user-agent"))
- // set custom user agent header
- .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36") // set the User-Agent header
- .build(); // build request
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement