From 8f3bf7050e65fdbe55eaad74fde307c57dab960e Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 24 七月 2026 17:25:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_business' into dev_business
---
yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/http/HttpUtilsTest.java | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/http/HttpUtilsTest.java b/yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/http/HttpUtilsTest.java
index a42874f..e2b6120 100644
--- a/yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/http/HttpUtilsTest.java
+++ b/yudao-framework/yudao-common/src/test/java/cn/iocoder/yudao/framework/common/util/http/HttpUtilsTest.java
@@ -10,6 +10,36 @@
public class HttpUtilsTest {
@Test
+ public void testEncodeUrlPath() {
+ // 鍑嗗鍙傛暟
+ String path = "avatar/涓枃 100%+鏂囦欢.jpg";
+
+ // 璋冪敤
+ String result = HttpUtils.encodeUrlPath(path);
+
+ // 鏂█
+ assertEquals("avatar/%E4%B8%AD%E6%96%87%20100%25+%E6%96%87%E4%BB%B6.jpg", result);
+ }
+
+ @Test
+ public void testDecodeUrlPath() {
+ // 鍑嗗鍙傛暟锛�+ 鏄矾寰勫瓧绗︼紝涓嶅簲璇ユ寜 query parameter 璇箟瑙g爜涓虹┖鏍�
+ String path = "avatar/%E4%B8%AD%E6%96%87%20100%25+%E6%96%87%E4%BB%B6.jpg";
+
+ // 璋冪敤
+ String result = HttpUtils.decodeUrlPath(path);
+
+ // 鏂█
+ assertEquals("avatar/涓枃 100%+鏂囦欢.jpg", result);
+ }
+
+ @Test
+ public void testRemoveUrlPathQueryAndFragment() {
+ assertEquals("avatar/test.jpg", HttpUtils.removeUrlPathQueryAndFragment("avatar/test.jpg?token=1#preview"));
+ assertEquals("avatar/test.jpg", HttpUtils.removeUrlPathQueryAndFragment("avatar/test.jpg#preview?token=1"));
+ }
+
+ @Test
public void testReplaceUrlQuery_replace() {
// 鍑嗗鍙傛暟
String url = "https://www.iocoder.cn/path?a=1&b=2";
--
Gitblit v1.9.3