From 39f96c9470265bd270e747922ada601749ee8576 Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期一, 11 四月 2022 17:13:42 +0800
Subject: [PATCH] 修改请求方法类

---
 src/main/java/com/hz/util/http/HttpHzUtil.java |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/hz/util/http/HttpHzUtil.java b/src/main/java/com/hz/util/http/HttpHzUtil.java
index 2c33ff4..3f4fce1 100644
--- a/src/main/java/com/hz/util/http/HttpHzUtil.java
+++ b/src/main/java/com/hz/util/http/HttpHzUtil.java
@@ -79,8 +79,13 @@
                 os.write(bodyData.getBytes(CHARSET));
             }
 
-            httpHzResponse.setCode(con.getResponseCode()+"");
-            httpHzResponse.setData(IOUtils.toString(con.getInputStream(), CHARSET));
+            if(HttpHzResponse.CODE_200.equals(con.getResponseCode())){
+                httpHzResponse.setCode(con.getResponseCode()+"");
+                httpHzResponse.setData(IOUtils.toString(con.getInputStream(), CHARSET));
+            }else{
+                httpHzResponse.setCode(con.getResponseCode()+"");
+                httpHzResponse.setMsg(IOUtils.toString(con.getErrorStream(), CHARSET));
+            }
 
         } catch (Exception var14) {
             var14.printStackTrace();

--
Gitblit v1.8.0