Issue #263
ASIFormDataRequest has a default 'GET' method (should be 'POST' by default)
Showing
3 changed files
with
11 additions
and
0 deletions
@@ -49,6 +49,7 @@ | @@ -49,6 +49,7 @@ | ||
49 | self = [super initWithURL:newURL]; | 49 | self = [super initWithURL:newURL]; |
50 | [self setPostFormat:ASIURLEncodedPostFormat]; | 50 | [self setPostFormat:ASIURLEncodedPostFormat]; |
51 | [self setStringEncoding:NSUTF8StringEncoding]; | 51 | [self setStringEncoding:NSUTF8StringEncoding]; |
52 | + [self setRequestMethod:@"POST"]; | ||
52 | return self; | 53 | return self; |
53 | } | 54 | } |
54 | 55 |
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | float progress; | 12 | float progress; |
13 | } | 13 | } |
14 | 14 | ||
15 | +- (void)testDefaultMethod; | ||
15 | - (void)testPostWithFileUpload; | 16 | - (void)testPostWithFileUpload; |
16 | - (void)testEmptyData; | 17 | - (void)testEmptyData; |
17 | - (void)testSubclass; | 18 | - (void)testSubclass; |
@@ -19,4 +20,5 @@ | @@ -19,4 +20,5 @@ | ||
19 | - (void)testCharset; | 20 | - (void)testCharset; |
20 | - (void)testPUT; | 21 | - (void)testPUT; |
21 | - (void)testCopy; | 22 | - (void)testCopy; |
23 | + | ||
22 | @end | 24 | @end |
@@ -17,6 +17,14 @@ | @@ -17,6 +17,14 @@ | ||
17 | 17 | ||
18 | @implementation ASIFormDataRequestTests | 18 | @implementation ASIFormDataRequestTests |
19 | 19 | ||
20 | + | ||
21 | +-(void)testDefaultMethod | ||
22 | +{ | ||
23 | + ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:@"http://wedontcare.com"]] autorelease]; | ||
24 | + | ||
25 | + GHAssertTrue([[request requestMethod] isEqualToString:@"POST"], @"Default request method should be POST"); | ||
26 | +} | ||
27 | + | ||
20 | - (void)testAddNilKeysAndValues | 28 | - (void)testAddNilKeysAndValues |
21 | { | 29 | { |
22 | ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/empty-post-value"]]; | 30 | ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/empty-post-value"]]; |
-
Please register or login to post a comment