feat: 升级1.1.0,解决get传参
This commit is contained in:
parent
b60caa6bd2
commit
a8f7c6adf4
4
pom.xml
4
pom.xml
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<groupId>group.flyfish</groupId>
|
<groupId>group.flyfish</groupId>
|
||||||
<artifactId>rest-proxy</artifactId>
|
<artifactId>rest-proxy</artifactId>
|
||||||
<version>1.0.9</version>
|
<version>1.1.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<commons-collection.version>4.4</commons-collection.version>
|
<commons-collection.version>4.4</commons-collection.version>
|
||||||
<commons.lang.version>2.6</commons.lang.version>
|
<commons.lang.version>2.6</commons.lang.version>
|
||||||
<sdk.version>1.0.9</sdk.version>
|
<sdk.version>1.1.0</sdk.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>group.flyfish</groupId>
|
<groupId>group.flyfish</groupId>
|
||||||
<artifactId>rest-proxy</artifactId>
|
<artifactId>rest-proxy</artifactId>
|
||||||
<version>1.0.9</version>
|
<version>1.1.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>group.flyfish</groupId>
|
<groupId>group.flyfish</groupId>
|
||||||
<artifactId>rest-proxy</artifactId>
|
<artifactId>rest-proxy</artifactId>
|
||||||
<version>1.0.9</version>
|
<version>1.1.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -21,10 +21,30 @@ public abstract class AbstractParamResolver {
|
|||||||
if (DataUtils.isNotEmpty(builder.getParams())) {
|
if (DataUtils.isNotEmpty(builder.getParams())) {
|
||||||
String start = builder.getUrl().contains("?") ? "&" : "?";
|
String start = builder.getUrl().contains("?") ? "&" : "?";
|
||||||
String params = builder.getParams().entrySet().stream()
|
String params = builder.getParams().entrySet().stream()
|
||||||
.map(entry -> entry.getKey() + "=" + (null == entry.getValue() ? "" : entry.getValue()))
|
.map(entry -> entry.getKey() + "=" + parseValue(entry.getValue()))
|
||||||
.collect(Collectors.joining("&"));
|
.collect(Collectors.joining("&"));
|
||||||
builder.url(builder.getUrl() + start + params);
|
builder.url(builder.getUrl() + start + params);
|
||||||
}
|
}
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析值
|
||||||
|
*
|
||||||
|
* @param value 值
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
private String parseValue(Object value) {
|
||||||
|
if (value instanceof String) {
|
||||||
|
return (String) value;
|
||||||
|
}
|
||||||
|
if (value instanceof Iterable) {
|
||||||
|
Iterable<? extends CharSequence> mapped = DataUtils.cast(value);
|
||||||
|
return String.join(",", mapped);
|
||||||
|
}
|
||||||
|
if (null != value) {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user