Permalink
Browse files

When adding data to the operation, change the HTTP method to POST onl…

…y if it is set to GET
  • Loading branch information...
milancermak committed Aug 9, 2012
1 parent fd10333 commit 56a404f8ab2ad5ca85650d02210da9713a6e9e63
Showing with 7 additions and 3 deletions.
  1. +7 −3 MKNetworkKit/MKNetworkOperation.m
@@ -677,8 +677,10 @@ -(void) addData:(NSData*) data forKey:(NSString*) key {
}
-(void) addData:(NSData*) data forKey:(NSString*) key mimeType:(NSString*) mimeType fileName:(NSString*) fileName {
-
- [self.request setHTTPMethod:@"POST"];
+
+ if ([self.request.HTTPMethod isEqualToString:@"GET"]) {
+ [self.request setHTTPMethod:@"POST"];
+ }
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
data, @"data",
@@ -697,7 +699,9 @@ -(void) addFile:(NSString*) filePath forKey:(NSString*) key {
-(void) addFile:(NSString*) filePath forKey:(NSString*) key mimeType:(NSString*) mimeType {
- [self.request setHTTPMethod:@"POST"];
+ if ([self.request.HTTPMethod isEqualToString:@"GET"]) {
+ [self.request setHTTPMethod:@"POST"];
+ }
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
filePath, @"filepath",

0 comments on commit 56a404f

Please sign in to comment.