Skip to content

Commit

Permalink
Update AbstractConnection.java
Browse files Browse the repository at this point in the history
修复toHtml
  • Loading branch information
Z-P-J committed Jan 11, 2020
1 parent 383dd7a commit b79e3a3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions zhttp/src/main/java/com/zpj/http/core/AbstractConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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---------------------------------------------------------

}

0 comments on commit b79e3a3

Please sign in to comment.