set response statuscode even if content length is zero

This commit is contained in:
dasha 2017-01-24 14:43:39 +02:00
parent 6c6fd49060
commit 9f4192f014

View File

@ -72,6 +72,10 @@
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location
{ {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)downloadTask.response;
if (!_statusCode) {
_statusCode = [NSNumber numberWithLong:httpResponse.statusCode];
}
NSURL *destURL = [NSURL fileURLWithPath:_params.toFile]; NSURL *destURL = [NSURL fileURLWithPath:_params.toFile];
NSFileManager *fm = [NSFileManager defaultManager]; NSFileManager *fm = [NSFileManager defaultManager];
NSError *error = nil; NSError *error = nil;