use of cn.hutool.core.net.url.UrlBuilder in project hutool by looly.
the class UrlBuilderTest method dotEncodeTest.
@Test
public void dotEncodeTest() {
final UrlBuilder urlBuilder = UrlBuilder.ofHttp("http://xtbgyy.digitalgd.com.cn/ebus/../../..", CharsetUtil.CHARSET_UTF_8);
Assert.assertEquals("http://xtbgyy.digitalgd.com.cn/ebus/../../..", urlBuilder.toString());
}
use of cn.hutool.core.net.url.UrlBuilder in project hutool by looly.
the class UrlBuilderTest method multiSlashTest.
@Test
public void multiSlashTest() {
// issue#I25MZL,某些URL中有多个斜杠,此为合法路径
final UrlBuilder urlBuilder = UrlBuilder.ofHttp("https://hutool.cn//file/test.jpg", CharsetUtil.CHARSET_UTF_8);
Assert.assertEquals("https://hutool.cn//file/test.jpg", urlBuilder.toString());
}
use of cn.hutool.core.net.url.UrlBuilder in project hutool by looly.
the class UrlBuilderTest method slashEncodeTest.
@Test
public void slashEncodeTest() {
// https://github.com/dromara/hutool/issues/1904
// 在query中,"/"是不可转义字符
// 见:https://www.rfc-editor.org/rfc/rfc3986.html#section-3.4
String url = "https://invoice.maycur.com/2b27a802-8423-4d41-86f5-63a6b259f61e.xlsx?download/2b27a802-8423-4d41-86f5-63a6b259f61e.xlsx&e=1630491088";
final UrlBuilder urlBuilder = UrlBuilder.ofHttp(url);
Assert.assertEquals(url, urlBuilder.toString());
}
use of cn.hutool.core.net.url.UrlBuilder in project hutool by looly.
the class UrlBuilderTest method testChineseFragmentWithPath.
@Test
public void testChineseFragmentWithPath() {
String buildUrl = new UrlBuilder().setScheme("https").setHost("www.hutool.cn").addPath("/s").setFragment("测试").build();
Assert.assertEquals("https://www.hutool.cn/s#%E6%B5%8B%E8%AF%95", buildUrl);
}
use of cn.hutool.core.net.url.UrlBuilder in project hutool by looly.
the class UrlBuilderTest method paramTest.
@Test
public void paramTest() {
String url = "http://ci.xiaohongshu.com/spectrum/c136c98aa2047babe25b994a26ffa7b492bd8058?imageMogr2/thumbnail/x800/format/jpg";
final UrlBuilder builder = UrlBuilder.ofHttp(url);
Assert.assertEquals(url, builder.toString());
}
Aggregations