diff --git a/zhttp/src/main/java/com/zpj/http/core/AbstractConnection.java b/zhttp/src/main/java/com/zpj/http/core/AbstractConnection.java index 3cc2c73..800dd3c 100644 --- a/zhttp/src/main/java/com/zpj/http/core/AbstractConnection.java +++ b/zhttp/src/main/java/com/zpj/http/core/AbstractConnection.java @@ -34,7 +34,7 @@ public abstract class AbstractConnection implements Connection { public static final String CONTENT_TYPE = "Content-Type"; public static final String MULTIPART_FORM_DATA = "multipart/form-data"; -// protected IHttp.OnRedirectListener onRedirectListener; + // protected IHttp.OnRedirectListener onRedirectListener; protected IHttp.OnSuccessListener onSuccessListener; protected IHttp.OnErrorListener onErrorListener; @@ -245,28 +245,31 @@ public Connection.Response response() { @Override public String toStr() throws IOException { - return execute().body(); + res = execute(); + return res.body(); } @Override public Document toHtml() throws IOException { - execute(); + res = execute(); return res.parse(); } @Override public JSONObject toJsonObject() throws IOException, JSONException { - return new JSONObject(execute().body()); + res = execute(); + return new JSONObject(res.body()); } @Override public JSONArray toJsonArray() throws IOException, JSONException { - return new JSONArray(execute().body()); + res = execute(); + return new JSONArray(res.body()); } @Override public Document toXml() throws IOException { - execute(); + res = execute(); return res.parse(); } @@ -321,9 +324,9 @@ public Connection contentType(String contentType) { //-----------------------------------------------------abstract methods----------------------------------------------------- public abstract Request createRequest(); -// public abstract Response createResponse(); + // public abstract Response createResponse(); public abstract Connection.Response execute() throws IOException; //-------------------------------------------------static methods--------------------------------------------------------- - + }