mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
改进UrlQuery
对无参URL增加判断识别(issue#IBRVE4@Gitee)
This commit is contained in:
parent
c10c144f64
commit
88cf61eb7f
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.37(2025-03-07)
|
# 5.8.37(2025-03-11)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【json 】 ObjectMapper删除重复trim(pr#3859@Github)
|
* 【json 】 ObjectMapper删除重复trim(pr#3859@Github)
|
||||||
@ -12,6 +12,7 @@
|
|||||||
* 【http 】 `HttpBase`增加重载可选是否返回声调(pr#3883@Github)
|
* 【http 】 `HttpBase`增加重载可选是否返回声调(pr#3883@Github)
|
||||||
* 【core 】 增加`VersionUtil`版本比较工具(pr#3876@Github)
|
* 【core 】 增加`VersionUtil`版本比较工具(pr#3876@Github)
|
||||||
* 【db 】 增加GoldenDB识别(pr#3886@Github)
|
* 【db 】 增加GoldenDB识别(pr#3886@Github)
|
||||||
|
* 【http 】 改进`UrlQuery`对无参URL增加判断识别(issue#IBRVE4@Gitee)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【setting】 修复`SettingLoader`load未抛出异常导致配置文件无法正常遍历的问题(pr#3868@Github)
|
* 【setting】 修复`SettingLoader`load未抛出异常导致配置文件无法正常遍历的问题(pr#3868@Github)
|
||||||
|
@ -222,6 +222,9 @@ public class UrlQuery {
|
|||||||
if (StrUtil.isBlank(queryStr)) {
|
if (StrUtil.isBlank(queryStr)) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
} else if(StrUtil.startWith(queryStr, "http://") || StrUtil.startWith(queryStr, "https://")){
|
||||||
|
// issue#IBRVE4 用户传入只有URL,没有param部分,返回空
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package cn.hutool.http;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
public class IssueIBRVE4Test {
|
||||||
|
@Test
|
||||||
|
public void decodeParamMapNoParamTest() {
|
||||||
|
// 参数值不存在分界标记等号时
|
||||||
|
// 无参数值时
|
||||||
|
final Map<String, List<String>> paramMap = HttpUtil.decodeParams("https://hutool.cn/api.action", CharsetUtil.CHARSET_UTF_8);
|
||||||
|
assertEquals(0,paramMap.size());
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void decodeParamMapListNoParamTest() {
|
||||||
|
// 参数值不存在分界标记等号时
|
||||||
|
// 无参数值时
|
||||||
|
final Map<String, String> paramMap1 = HttpUtil.decodeParamMap("https://hutool.cn/api.action", CharsetUtil.CHARSET_UTF_8);
|
||||||
|
assertEquals(0,paramMap1.size());
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user