Skip to content

Commit ce882b7

Browse files
committed
Updated return format
1 parent 3e14d4b commit ce882b7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/java/io/appsfly/core/AppInstance.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.appsfly.crypto.CtyptoUtil;
44
import io.appsfly.util.json.JSONArray;
5+
import io.appsfly.util.json.JSONException;
56
import io.appsfly.util.json.JSONObject;
67
import io.appsfly.util.json.JSONTokener;
78
import okhttp3.*;
@@ -67,7 +68,11 @@ public void onResponse(Call call, final okhttp3.Response response) throws IOExce
6768
byte[] bytes = response.body().bytes();
6869
boolean verified = CtyptoUtil.getInstance().verifychecksum(bytes, checksum, config.secretKey);
6970
if (verified) {
70-
callback.onResponse(new JSONObject(bytes));
71+
try {
72+
callback.onResponse(new JSONTokener(new String(bytes)).nextValue());
73+
} catch (JSONException e) {
74+
callback.onResponse(new JSONObject());
75+
}
7176
} else {
7277
callback.onError(new JSONObject() {{
7378
put("message", "Checksum Validation Failed");

src/main/java/io/appsfly/core/Callback.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io.appsfly.util.json.JSONObject;
44

55
public interface Callback {
6-
void onResponse(JSONObject response);
6+
void onResponse(Object response);
7+
78
void onError(JSONObject error);
89
}

0 commit comments

Comments
 (0)