mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix URL
This commit is contained in:
@@ -170,4 +170,22 @@ public class UrlBuilderTest {
|
||||
|
||||
Assert.assertEquals("frag1", builder.getFragment());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void weixinUrlTest(){
|
||||
String urlStr = "https://mp.weixin.qq.com/s?" +
|
||||
"__biz=MzI5NjkyNTIxMg==" +
|
||||
"&mid=100000465" +
|
||||
"&idx=1" +
|
||||
"&sn=1044c0d19723f74f04f4c1da34eefa35" +
|
||||
"&chksm=6cbda3a25bca2ab4516410db6ce6e125badaac2f8c5548ea6e18eab6dc3c5422cb8cbe1095f7";
|
||||
final UrlBuilder builder = UrlBuilder.ofHttp(urlStr, CharsetUtil.CHARSET_UTF_8);
|
||||
// 原URL中的&替换为&,value中的=被编码为%3D
|
||||
Assert.assertEquals("https://mp.weixin.qq.com/s?" +
|
||||
"__biz=MzI5NjkyNTIxMg%3D%3D" +
|
||||
"&mid=100000465&idx=1" +
|
||||
"&sn=1044c0d19723f74f04f4c1da34eefa35" +
|
||||
"&chksm=6cbda3a25bca2ab4516410db6ce6e125badaac2f8c5548ea6e18eab6dc3c5422cb8cbe1095f7",
|
||||
builder.toString());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user