Skip to content

Commit 7d6d637

Browse files
committed
Fixed 2d34e1c leftover, Closes android-async-http#86
1 parent 31e5d02 commit 7d6d637

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/src/com/loopj/android/http/JsonHttpResponseHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void run() {
161161
}
162162
}).start();
163163
} else {
164-
sendMessage(obtainMessage(SUCCESS_JSON_MESSAGE, new Object[]{statusCode, new JSONObject()}));
164+
sendMessage(obtainMessage(SUCCESS_JSON_MESSAGE, new Object[]{statusCode, headers, new JSONObject()}));
165165
}
166166
}
167167

@@ -187,13 +187,15 @@ protected void handleSuccessJsonMessage(int statusCode, Header[] headers, Object
187187
onSuccess(statusCode, headers, (JSONObject) jsonResponse);
188188
} else if (jsonResponse instanceof JSONArray) {
189189
onSuccess(statusCode, headers, (JSONArray) jsonResponse);
190+
} else if (jsonResponse instanceof String) {
191+
onSuccess(statusCode, headers, (String) jsonResponse);
190192
} else {
191193
onFailure(new JSONException("Unexpected type " + jsonResponse.getClass().getName()), (JSONObject) null);
192194
}
193195
}
194196

195197
protected Object parseResponse(String responseBody) throws JSONException {
196-
if(null == responseBody)
198+
if (null == responseBody)
197199
return null;
198200
Object result = null;
199201
//trim the string to prevent start with blank, and test if the string is valid JSON, because the parser don't do this :(. If Json is not valid this will return null

0 commit comments

Comments
 (0)