Skip to content

Commit

Permalink
Merge pull request #8 from lunasaw/dev_2.4.3
Browse files Browse the repository at this point in the history
🔖✏️   httpResponse check fix
  • Loading branch information
lunasaw authored Apr 22, 2023
2 parents 5297021 + 7bfd78a commit f41abc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>io.github.lunasaw</groupId>
<artifactId>luna-common</artifactId>
<name>luna-common</name>
<version>2.4.2</version>
<version>2.4.3</version>
<description>common is project which contains common utils</description>
<url>https://github.com/lunasaw/luna-common</url>

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/luna/common/net/HttpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
*/
public class HttpUtils {

public static final HttpClientContext CLIENT_CONTEXT = HttpClientContext.create();
public static final HttpClientContext CLIENT_CONTEXT = HttpClientContext.create();
private static final int MAX_REDIRECTS = 10;
private static CloseableHttpClient httpClient;

Expand Down Expand Up @@ -571,7 +571,7 @@ public static String buildUrl(String host, String path, Map<?, ?> queries) {
* @param httpResponse 响应体
* @return String
*/
public static String checkResponseAndGetResult(ClassicHttpResponse httpResponse, boolean isEnsure) {
public static String checkResponseAndGetResultV2(ClassicHttpResponse httpResponse, boolean isEnsure) {
if (httpResponse == null) {
throw new RuntimeException();
}
Expand Down Expand Up @@ -708,4 +708,8 @@ public static String checkResponseAndGetResult(ClassicHttpResponse httpResponse)
public static String checkResponseAndGetResult(HttpResponse httpResponse) {
return checkResponseAndGetResult((ClassicHttpResponse)httpResponse, ImmutableList.of(HttpStatus.SC_OK));
}

public static String checkResponseAndGetResult(HttpResponse httpResponse, Boolean isEnsure) {
return checkResponseAndGetResultV2((ClassicHttpResponse) httpResponse, isEnsure);
}
}

0 comments on commit f41abc7

Please sign in to comment.