This commit is contained in:
Looly 2020-10-21 13:21:05 +08:00
parent 4e46606e60
commit 59202e8061
3 changed files with 8 additions and 1 deletions

View File

@ -204,4 +204,10 @@ public class UrlBuilderTest {
final UrlBuilder urlBuilder = UrlBuilder.ofHttp("http://a.com/aaa bbb.html", CharsetUtil.CHARSET_UTF_8);
Assert.assertEquals("http://a.com/aaa%20bbb.html", urlBuilder.toString());
}
@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());
}
}

View File

@ -531,7 +531,7 @@ public class HttpConnection {
final URLConnection conn = openConnection();
if (false == conn instanceof HttpURLConnection) {
// 防止其它协议造成的转换异常
throw new HttpException("'{}' is not a http connection, make sure URL is format for http.", conn.getClass().getName());
throw new HttpException("'{}' of URL [{}] is not a http connection, make sure URL is format for http.", conn.getClass().getName(), this.url);
}
return (HttpURLConnection) conn;

View File

@ -143,4 +143,5 @@ public class HttpRequestTest {
HttpResponse execute = get.execute();
Console.log(execute.body());
}
}