Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix duplicated http path is certain scenarios #304

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/main/java/com/algorand/algosdk/v2/client/common/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ protected <T>Response<T> baseExecute() throws Exception {

protected <T>Response<T> baseExecute(String[] headers, String[] values) throws Exception {

QueryData qData = this.getRequestString();
com.squareup.okhttp.Response resp = this.client.executeCall(qData, httpMethod, headers, values);
// Make sure the path is generated by calling getRequestString (at most) once.
if (qd.pathSegments.size() == 0) {
this.getRequestString();
}
if(qd.pathSegments.size() == 0 ) {
throw new RuntimeException("Something unexpected went wrong. QueryData path segment is not populated.");
}

com.squareup.okhttp.Response resp = this.client.executeCall(qd, httpMethod, headers, values);
if (resp.isSuccessful()) {
return new Response<T>(resp.code(), null, resp.body().contentType().toString(), resp.body().bytes());
} else {
Expand Down