mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-04-28 00:02:49 +08:00
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:
@@ -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]];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user