mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix redirect bug
This commit is contained in:
@@ -26,7 +26,6 @@ import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -203,7 +202,19 @@ public class DownloadTest {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void downloadTeamViewerTest() throws IOException {
|
||||
public void downloadTeamViewerByOkHttpTest() {
|
||||
// 此URL有3次重定向, 需要请求4次
|
||||
final String url = "https://download.teamviewer.com/download/TeamViewer_Setup_x64.exe";
|
||||
HttpGlobalConfig.setMaxRedirects(2);
|
||||
|
||||
final Response send = Request.of(url).send(ClientEngineFactory.createEngine("okhttp"));
|
||||
Console.log(send.getStatus());
|
||||
Console.log(send.headers());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void downloadTeamViewerByJdkTest() {
|
||||
// 此URL有3次重定向, 需要请求4次
|
||||
final String url = "https://download.teamviewer.com/download/TeamViewer_Setup_x64.exe";
|
||||
HttpGlobalConfig.setMaxRedirects(2);
|
||||
@@ -212,4 +223,16 @@ public class DownloadTest {
|
||||
Console.log(send.getStatus());
|
||||
Console.log(send.headers());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
public void downloadTeamViewerByHttpClient5Test() {
|
||||
// 此URL有3次重定向, 需要请求4次
|
||||
final String url = "https://download.teamviewer.com/download/TeamViewer_Setup_x64.exe";
|
||||
HttpGlobalConfig.setMaxRedirects(2);
|
||||
|
||||
final Response send = Request.of(url).send(ClientEngineFactory.createEngine("HttpClient5"));
|
||||
Console.log(send.getStatus());
|
||||
Console.log(send.headers());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user