Remove unusd imports. Handle redirects properly.
This commit is contained in:
parent
1afe6eb0ba
commit
004e0efd6c
@ -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 {
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user