Ben Copsey

Added convenience constructors

... ... @@ -21,6 +21,11 @@
return self;
}
+ (id)requestWithURL:(NSURL *)newURL
{
return [[[ASIFormDataRequest alloc] initWithURL:newURL] autorelease];
}
- (void)dealloc
{
[postData release];
... ...
... ... @@ -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
... ...
... ... @@ -104,6 +104,11 @@ static NSError *ASIUnableToCreateRequestError;
return self;
}
+ (id)requestWithURL:(NSURL *)newURL
{
return [[[ASIHTTPRequest alloc] initWithURL:newURL] autorelease];
}
- (void)dealloc
{
if (requestAuthentication) {
... ...
... ... @@ -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;
... ...
... ... @@ -40,6 +40,11 @@
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
... ...
... ... @@ -21,7 +21,7 @@
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
... ...
... ... @@ -17,8 +17,8 @@
- (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");
... ...
... ... @@ -19,7 +19,7 @@
complete = NO;
progress = 0;
networkQueue = [[ASINetworkQueue alloc] init];
networkQueue = [[ASINetworkQueue queue] retain];
[networkQueue setDownloadProgressDelegate:self];
[networkQueue setDelegate:self];
[networkQueue setShowAccurateProgress:NO];
... ...