Skip to content

Commit

Permalink
Merge pull request #3 from Curious-chen/main
Browse files Browse the repository at this point in the history
添加URL参数
  • Loading branch information
unclezs committed Jul 9, 2023
2 parents b782343 + 26956b6 commit f94a707
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<dependency>
<groupId>com.unclezs</groupId>
<artifactId>novel-analyzer</artifactId>
<version>1.0.26</version>
<version>1.0.27</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<name>novel-analyzer</name>
<groupId>com.unclezs</groupId>
<artifactId>novel-analyzer</artifactId>
<version>1.0.26</version>
<version>1.0.27</version>

<url>https://github.com/unclezs/novel-analyzer</url>
<description>Uncle小说解析 SDK</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public class RequestParams implements Verifiable, Serializable {
* 请求体
*/
private String body;

/**
* URL参数(查询字符串)
*/
private String urlParams;
/**
* 是否为动态网页
*/
Expand Down Expand Up @@ -111,6 +116,10 @@ public static RequestParams create(String url, RequestParams params) {
} else {
params = params.copy();
}
// 添加URL参数
if (StringUtils.isNotBlank(params.getUrlParams())) {
url = url+ (url.contains("?") ? "&" : "?") + params.getUrlParams();
}
params.setUrl(url);
return params;
}
Expand Down Expand Up @@ -197,6 +206,8 @@ public void setHeader(String headerName, String headerValue) {
headers.put(headerName, headerValue);
}



/**
* 设置请求头 如果不存在则设置 存在则忽略
*
Expand Down

0 comments on commit f94a707

Please sign in to comment.