改进UrlQuery对无参URL增加判断识别(issue#IBRVE4@Gitee)

This commit is contained in:
Looly
2025-03-11 09:25:56 +08:00
parent c10c144f64
commit 88cf61eb7f
3 changed files with 31 additions and 1 deletions

View File

@@ -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());
}
}