Ben Copsey

Fix URLs in tests

Close postBodyReadStream when request is complete
@@ -583,6 +583,8 @@ static NSError *ASITooMuchRedirectionError; @@ -583,6 +583,8 @@ static NSError *ASITooMuchRedirectionError;
583 readStream = NULL; 583 readStream = NULL;
584 } 584 }
585 585
  586 + [[self postBodyReadStream] close];
  587 +
586 if (rawResponseData) { 588 if (rawResponseData) {
587 [self setRawResponseData:nil]; 589 [self setRawResponseData:nil];
588 590
@@ -1027,8 +1029,6 @@ static NSError *ASITooMuchRedirectionError; @@ -1027,8 +1029,6 @@ static NSError *ASITooMuchRedirectionError;
1027 [self setRequestMethod:@"GET"]; 1029 [self setRequestMethod:@"GET"];
1028 [self setPostBody:nil]; 1030 [self setPostBody:nil];
1029 [self setPostLength:0]; 1031 [self setPostLength:0];
1030 - [self setPostBodyFilePath:nil];  
1031 - [self setPostBodyWriteStream:nil];  
1032 [self setRequestHeaders:nil]; 1032 [self setRequestHeaders:nil];
1033 } 1033 }
1034 [self setURL:[[NSURL URLWithString:[responseHeaders valueForKey:@"Location"] relativeToURL:[self url]] absoluteURL]]; 1034 [self setURL:[[NSURL URLWithString:[responseHeaders valueForKey:@"Location"] relativeToURL:[self url]] absoluteURL]];
@@ -1356,6 +1356,8 @@ static NSError *ASITooMuchRedirectionError; @@ -1356,6 +1356,8 @@ static NSError *ASITooMuchRedirectionError;
1356 readStream = NULL; 1356 readStream = NULL;
1357 } 1357 }
1358 1358
  1359 + [[self postBodyReadStream] close];
  1360 +
1359 NSError *fileError = nil; 1361 NSError *fileError = nil;
1360 1362
1361 // Delete up the request body temporary file, if it exists 1363 // Delete up the request body temporary file, if it exists
@@ -670,11 +670,11 @@ @@ -670,11 +670,11 @@
670 // Ensure request method changes to get 670 // Ensure request method changes to get
671 - (void)test303Redirect 671 - (void)test303Redirect
672 { 672 {
673 - ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://asi/ASIHTTPRequest/tests/redirect_303"]]; 673 + ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/redirect_303"]];
674 [request setRequestMethod:@"PUT"]; 674 [request setRequestMethod:@"PUT"];
675 [request appendPostData:[@"Fuzzy" dataUsingEncoding:NSUTF8StringEncoding]]; 675 [request appendPostData:[@"Fuzzy" dataUsingEncoding:NSUTF8StringEncoding]];
676 [request start]; 676 [request start];
677 - BOOL success = [[[request url] absoluteString] isEqualToString:@"http://asi/ASIHTTPRequest/tests/request-method"]; 677 + BOOL success = [[[request url] absoluteString] isEqualToString:@"http://allseeing-i.com/ASIHTTPRequest/tests/request-method"];
678 GHAssertTrue(success,@"Failed to redirect to correct location"); 678 GHAssertTrue(success,@"Failed to redirect to correct location");
679 success = [[request responseString] isEqualToString:@"GET"]; 679 success = [[request responseString] isEqualToString:@"GET"];
680 GHAssertTrue(success,@"Failed to use GET on new URL"); 680 GHAssertTrue(success,@"Failed to use GET on new URL");