修复HttpDownloader全局超时无效问题

This commit is contained in:
Looly 2024-04-26 15:30:04 +08:00
parent 88cf47b5bb
commit 5a1b50f1de
2 changed files with 30 additions and 0 deletions

View File

@ -46,6 +46,7 @@ public class HttpDownloader {
* @param url 请求的url
* @param timeout 超时毫秒数
* @return 文件数据
* @since 5.8.28
*/
public static byte[] downloadBytes(String url, int timeout) {
return requestDownload(url, timeout).bodyBytes();

View File

@ -0,0 +1,29 @@
package cn.hutool.json;
import lombok.Data;
import org.junit.Assert;
import org.junit.Test;
public class BeanToJsonTest {
@Test
public void toJsonStrTest() {
final ReadParam readParam = new ReadParam();
readParam.setInitSpikeMac("a");
readParam.setMac("b");
readParam.setSpikeMac("c");
readParam.setBag("d");
readParam.setProjectId(123);
//Console.log(JSONUtil.toJsonStr(readParam));
Assert.assertEquals("{\"initSpikeMac\":\"a\",\"mac\":\"b\",\"spikeMac\":\"c\",\"bag\":\"d\",\"projectId\":123}", JSONUtil.toJsonStr(readParam));
}
@Data
private static class ReadParam{
private String initSpikeMac;
private String mac;
private String spikeMac;
private String bag;
private Integer projectId;
}
}