Remove unusd imports. Handle redirects properly.

This commit is contained in:
sigonasr2, Sig, Sigo 2022-04-26 15:34:04 +00:00
parent 1afe6eb0ba
commit 004e0efd6c
2 changed files with 4 additions and 7 deletions

View File

@ -1,13 +1,9 @@
package sig; package sig;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import sig.exceptions.FailedResponseException; import sig.exceptions.FailedResponseException;
import sig.requests.GETRequest; import sig.requests.GETRequest;
public class client { public class client {
public static void main(String[] args) { public static void main(String[] args) {
try { try {

View File

@ -1,6 +1,5 @@
package sig.requests; package sig.requests;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -59,7 +58,9 @@ public class GETRequest{
.headers(headers) .headers(headers)
.timeout(Duration.ofMillis(timeout)) .timeout(Duration.ofMillis(timeout))
.GET().build(); .GET().build();
client = HttpClient.newBuilder().build(); client = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.ALWAYS)
.build();
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
e.printStackTrace(); e.printStackTrace();
} }