CB-6928 Wrong behaviour transferring cacheable content

Adds support of 304 handling for iOS, Windows and adds a corresponding test
This commit is contained in:
daserge
2015-11-09 16:25:03 +03:00
parent 5857384b94
commit 189942284a
4 changed files with 32 additions and 3 deletions
+2 -1
View File
@@ -592,7 +592,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[self.filePlugin makeEntryForURL:self.targetURL]];
} else {
downloadResponse = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];
CDVFileTransferError errorCode = self.responseCode == 404 ? FILE_NOT_FOUND_ERR : CONNECTION_ERR;
CDVFileTransferError errorCode = self.responseCode == 404 ? FILE_NOT_FOUND_ERR
: (self.responseCode == 304 ? NOT_MODIFIED : CONNECTION_ERR);
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[command createFileTransferError:errorCode AndSource:source AndTarget:target AndHttpStatus:self.responseCode AndBody:downloadResponse]];
}
}