Merge branch 'v5-dev' of https://github.com/totalo/hutool into v5-dev

This commit is contained in:
totalo
2020-09-25 15:32:39 +08:00
154 changed files with 3750 additions and 949 deletions

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.4.2</version>
<version>5.4.4-SNAPSHOT</version>
</parent>
<artifactId>hutool-http</artifactId>

View File

@@ -69,7 +69,7 @@ public class GlobalCookieManager {
Map<String, List<String>> cookieHeader;
try {
cookieHeader = cookieManager.get(getURI(conn), new HashMap<String, List<String>>(0));
cookieHeader = cookieManager.get(getURI(conn), new HashMap<>(0));
} catch (IOException e) {
throw new IORuntimeException(e);
}

View File

@@ -93,7 +93,7 @@ public class SoapClient extends HttpBase<SoapClient> {
* 创建SOAP客户端默认使用soap1.1版本协议
*
* @param url WS的URL地址
* @return {@link SoapClient}
* @return this
*/
public static SoapClient create(String url) {
return new SoapClient(url);
@@ -104,7 +104,7 @@ public class SoapClient extends HttpBase<SoapClient> {
*
* @param url WS的URL地址
* @param protocol 协议,见{@link SoapProtocol}
* @return {@link SoapClient}
* @return this
*/
public static SoapClient create(String url, SoapProtocol protocol) {
return new SoapClient(url, protocol);
@@ -116,7 +116,7 @@ public class SoapClient extends HttpBase<SoapClient> {
* @param url WS的URL地址
* @param protocol 协议,见{@link SoapProtocol}
* @param namespaceURI 方法上的命名空间URI
* @return {@link SoapClient}
* @return this
* @since 4.5.6
*/
public static SoapClient create(String url, SoapProtocol protocol, String namespaceURI) {

View File

@@ -133,4 +133,14 @@ public class HttpRequestTest {
HttpRequest request = HttpUtil.createGet("http://localhost:8888/get");
Console.log(request.execute().body());
}
@Test
@Ignore
public void getWithoutEncodeTest(){
String url = "https://img-cloud.voc.com.cn/140/2020/09/03/c3d41b93e0d32138574af8e8b50928b376ca5ba61599127028157.png?imageMogr2/auto-orient/thumbnail/500&pid=259848";
HttpRequest get = HttpUtil.createGet(url);
Console.log(get.getUrl());
HttpResponse execute = get.execute();
Console.log(execute.body());
}
}

View File

@@ -236,7 +236,8 @@ public class HttpUtilTest {
map = HttpUtil.decodeParams(a, CharsetUtil.UTF_8);
Assert.assertEquals("b", map.get("a").get(0));
Assert.assertEquals("d", map.get("c").get(0));
Assert.assertEquals("", map.get("e").get(0));
Assert.assertNull(map.get("e").get(0));
Assert.assertNull(map.get("").get(0));
// 被编码的键和值被还原
a = "a=bbb&c=%E4%BD%A0%E5%A5%BD&%E5%93%88%E5%96%BD=";