You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/03/27 19:29:58 UTC
ios commit: [CB-51] Added httpMethod for file transfer options
(defaults to POST)
Updated Branches:
refs/heads/master d6a35768e -> 43edb033b
[CB-51] Added httpMethod for file transfer options (defaults to POST)
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/43edb033
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/43edb033
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/43edb033
Branch: refs/heads/master
Commit: 43edb033b747b0f0a4d9b5735e1034a4875b63ab
Parents: d6a3576
Author: Jasonm23 <ja...@gmail.com>
Authored: Fri Mar 22 14:12:58 2013 +1100
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Mar 27 14:25:39 2013 -0400
----------------------------------------------------------------------
CordovaLib/Classes/CDVFileTransfer.m | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/43edb033/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index 9f14ef5..bbb601d 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -136,7 +136,10 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
// BOOL trustAllHosts = [[arguments objectAtIndex:6 withDefault:[NSNumber numberWithBool:YES]] boolValue]; // allow self-signed certs
BOOL chunkedMode = [[arguments objectAtIndex:7 withDefault:[NSNumber numberWithBool:YES]] boolValue];
NSDictionary* headers = [arguments objectAtIndex:8 withDefault:nil];
-
+ // Allow alternative http method, default to POST. JS side checks
+ // for allowed methods, currently PUT or POST (forces POST for
+ // unrecognised values)
+ NSString* httpMethod = [arguments objectAtIndex:10 withDefault:@"POST"];
CDVPluginResult* result = nil;
CDVFileTransferError errorCode = 0;
@@ -158,7 +161,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
}
NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL:url];
- [req setHTTPMethod:@"POST"];
+
+ [req setHTTPMethod: httpMethod];
// Magic value to set a cookie
if ([options objectForKey:kOptionsKeyCookie]) {