receive content data even though status code is not 2xx

This commit is contained in:
byeonggee.seo 2015-02-03 16:28:23 +09:00
parent 6f53719772
commit 753335726a
2 changed files with 22 additions and 12 deletions

View File

@ -87,13 +87,13 @@
| 205 ; Reset Content
| 206 ; Partial Content
*/
if (responseCode < 200 || responseCode >= 300)
{// something went wrong, abort the whole thing
// if (responseCode < 200 || responseCode >= 300)
// {// something went wrong, abort the whole thing
[connection cancel];
finish = true;
return;
}
// [connection cancel];
// finish = true;
// return;
// }
[responseData setLength:0];
}

View File

@ -260,8 +260,17 @@ public class Cocos2dxHttpURLConnection
}
static byte[] getResponseContent(HttpURLConnection http) {
DataInputStream in;
try {
in = new DataInputStream(http.getInputStream());
} catch (IOException e) {
in = new DataInputStream(http.getErrorStream());
} catch (Exception e) {
Log.e("Cocos2dxHttpURLConnection exception", e.toString());
return null;
}
try {
DataInputStream in = new DataInputStream(http.getInputStream());
byte[] buffer = new byte[1024];
int size = 0;
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
@ -275,6 +284,7 @@ public class Cocos2dxHttpURLConnection
} catch (Exception e) {
Log.e("Cocos2dxHttpURLConnection exception", e.toString());
}
return null;
}