Skip to content

Commit 3399a19

Browse files
author
崔成龙
committed
修改参数截取逻辑,只有get请求,才会截取参数~
1 parent 35e8c6b commit 3399a19

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
## Maven坐标:
66
```
7+
<!-- https://mvnrepository.com/artifact/com.arronlong/httpclientutil -->
78
<dependency>
8-
<groupId>com.arronlong</groupId>
9-
<artifactId>httpclientutil</artifactId>
10-
<version>1.0.1</version>
9+
<groupId>com.arronlong</groupId>
10+
<artifactId>httpclientutil</artifactId>
11+
<version>1.0.1</version>
1112
</dependency>
1213
```
1314

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.arronlong</groupId>
55
<artifactId>httpclientutil</artifactId>
6-
<version>1.0.1</version>
6+
<version>1.0.2-SNAPSHOT</version>
77
<name>${project.artifactId}</name>
88
<description>基于HttpClient-4.4.1封装的工具类。支持插件式配置Header、插件式配置httpclient对象,这样就可以方便地自定义header信息、配置ssl、配置proxy、Cookie等</description>
99

src/main/java/com/arronlong/httpclientutil/HttpClientUtil.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,11 @@ private static HttpResponse execute(HttpConfig config) throws HttpProcessExcepti
397397
if(HttpEntityEnclosingRequestBase.class.isAssignableFrom(request.getClass())){
398398
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
399399

400-
//检测url中是否存在参数
401-
config.url(Utils.checkHasParas(config.url(), nvps, config.inenc()));
400+
if(request.getClass()==HttpGet.class) {
401+
//检测url中是否存在参数
402+
//注:只有get请求,才自动截取url中的参数,post等其他方式,不再截取
403+
config.url(Utils.checkHasParas(config.url(), nvps, config.inenc()));
404+
}
402405

403406
//装填参数
404407
HttpEntity entity = Utils.map2HttpEntity(nvps, config.map(), config.inenc());

0 commit comments

Comments
 (0)