mirror of https://github.com/axmolengine/axmol.git
receive content data even though status code is not 2xx
This commit is contained in:
parent
6f53719772
commit
753335726a
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -260,8 +260,17 @@ public class Cocos2dxHttpURLConnection
|
|||
}
|
||||
|
||||
static byte[] getResponseContent(HttpURLConnection http) {
|
||||
try {
|
||||
DataInputStream in = new DataInputStream(http.getInputStream());
|
||||
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 {
|
||||
byte[] buffer = new byte[1024];
|
||||
int size = 0;
|
||||
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
|
||||
|
@ -272,9 +281,10 @@ public class Cocos2dxHttpURLConnection
|
|||
byte retbuffer[] = bytestream.toByteArray();
|
||||
bytestream.close();
|
||||
return retbuffer;
|
||||
} catch (Exception e) {
|
||||
Log.e("Cocos2dxHttpURLConnection exception", e.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("Cocos2dxHttpURLConnection exception", e.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue