Check response code for DownloadClient
This commit is contained in:
1 parent
e156d27f20
commit
76a241d2da
1 file changed
+7
@@ -22,6 +22,7 @@ import android.webkit.MimeTypeMap;
|
||||
import com.hippo.httpclient.HttpClient;
|
||||
import com.hippo.httpclient.HttpRequest;
|
||||
import com.hippo.httpclient.HttpResponse;
|
||||
import com.hippo.httpclient.ResponseCodeException;
|
||||
import com.hippo.io.UniFileOutputStreamPipe;
|
||||
import com.hippo.unifile.UniFile;
|
||||
import com.hippo.yorozuya.FileUtils;
|
||||
@@ -106,6 +107,12 @@ public class DownloadClient {
|
||||
|
||||
HttpResponse httpResponse = httpClient.execute(httpRequest);
|
||||
|
||||
// Check response code
|
||||
int responseCode = httpResponse.getResponseCode();
|
||||
if (responseCode >= 400) {
|
||||
throw new ResponseCodeException(responseCode);
|
||||
}
|
||||
|
||||
osPipe = request.mOSPipe;
|
||||
if (osPipe == null) {
|
||||
String extension;
|
||||
|
||||
Reference in new issue
Block a user