Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added convenience constructors

  • Loading branch information...
commit 951834fafa8221a6eaf79e82f1534411a7e0c694 1 parent 5ed9ff3
@pokeb authored
View
5 Classes/ASIFormDataRequest.m
@@ -21,6 +21,11 @@ - (id)initWithURL:(NSURL *)newURL
return self;
}
++ (id)requestWithURL:(NSURL *)newURL
+{
+ return [[[ASIFormDataRequest alloc] initWithURL:newURL] autorelease];
+}
+
- (void)dealloc
{
[postData release];
View
3  Classes/ASIHTTPRequest.h
@@ -222,6 +222,9 @@ extern NSString* const NetworkRequestErrorDomain;
// Should be an HTTP or HTTPS url, may include username and password if appropriate
- (id)initWithURL:(NSURL *)newURL;
+// Convenience constructor
++ (id)requestWithURL:(NSURL *)newURL;
+
#pragma mark setup request
// Add a custom header to the request
View
5 Classes/ASIHTTPRequest.m
@@ -104,6 +104,11 @@ - (id)initWithURL:(NSURL *)newURL
return self;
}
++ (id)requestWithURL:(NSURL *)newURL
+{
+ return [[[ASIHTTPRequest alloc] initWithURL:newURL] autorelease];
+}
+
- (void)dealloc
{
if (requestAuthentication) {
View
3  Classes/ASINetworkQueue.h
@@ -57,6 +57,9 @@
}
+// Convenience constructor
++ (id)queue;
+
// Used internally to manage HEAD requests when showAccurateProgress is YES, do not use!
- (void)addHEADOperation:(NSOperation *)operation;
View
5 Classes/ASINetworkQueue.m
@@ -40,6 +40,11 @@ - (id)init
return self;
}
++ (id)queue
+{
+ return [[[ASINetworkQueue alloc] init] autorelease];
+}
+
- (void)dealloc
{
//We need to clear the delegate on any requests that haven't got around to cleaning up yet, as otherwise they'll try to let us know if something goes wrong, and we'll be long gone by then
View
2  Classes/Tests/ASIFormDataRequestTests.m
@@ -21,7 +21,7 @@ - (void)testPostWithFileUpload
NSString *path = [[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"bigfile"];
[data writeToFile:path atomically:NO];
- ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
+ ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSDate *d = [NSDate date];
#if TARGET_OS_IPHONE
View
4 Classes/Tests/ASIHTTPRequestTests.m
@@ -17,8 +17,8 @@ @implementation ASIHTTPRequestTests
- (void)testBasicDownload
{
- NSURL *url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com"] autorelease];
- ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+ NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
+ ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request start];
NSString *html = [request responseString];
GHAssertNotNil(html,@"Basic synchronous request failed");
View
2  Classes/Tests/ASINetworkQueueTests.m
@@ -19,7 +19,7 @@ - (void)testProgress
complete = NO;
progress = 0;
- networkQueue = [[ASINetworkQueue alloc] init];
+ networkQueue = [[ASINetworkQueue queue] retain];
[networkQueue setDownloadProgressDelegate:self];
[networkQueue setDelegate:self];
[networkQueue setShowAccurateProgress:NO];
Please sign in to comment.
Something went wrong with that request. Please try again.